How to tell if a variable is a string or a list, or etc in Sikuli?

Asked by eduardobedoya

I would like to check if variable is a string or a list, or etc in Sikuli? I mean variables that are currently been used in the IDLE. Thanks Advanced.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
RaiMan (raimund-hocke) said :
#1

Python !!!

Revision history for this message
eduardobedoya (gonnabdh) said :
#3

Sometimes you store a list as a string in order to apply regex to it,
but then how you realize if it is string or a list
also I watched in some Tutorial, someway to display all the values of the current variables in screen.
Is it possible to have a kinda variable values check in sikuli?

I have tried to read this...
http://stackoverflow.com/questions/836387/how-can-i-tell-if-a-python-variable-is-a-string-or-a-list
and this...
http://stackoverflow.com/questions/922774/check-if-input-is-a-list-tuple-of-strings-or-a-single-string
I just cant get them to work.

Could RainMan you please suggest a link???

Revision history for this message
RaiMan (raimund-hocke) said :
#4
Revision history for this message
eduardobedoya (gonnabdh) said :
#6

Is there any way to display all current variables values in IDLE, I could swear I saw something like that in a Python Tutorial, Ijust can recall.
Thanks Advanced.

Revision history for this message
RaiMan (raimund-hocke) said :
#7

look for the list globals and locals

Revision history for this message
RaiMan (raimund-hocke) said :
#8

look for the list globals and locals

Revision history for this message
eduardobedoya (gonnabdh) said :
#9

Thanks RaiMan, that solved my question.

Revision history for this message
eduardobedoya (gonnabdh) said :
#11

Sorry,
I just don't get it
I have read this part...
isinstance(object, classinfo) I read the paragraphs that talk about Local n Global
but it doesn't provide examples

what parameters have to be put in 'object, classinfo' in here...
isinstance(object, classinfo)???

Sorry
isn't there any other tutorial site with examples?

That part off manual talks about tuples, clasess. I have read some about those, but, for the moment I just use variables n lists, and I would like to check its values when running sikuli, and tell when something is a string, or an integer, or a list, in order to test.

Revision history for this message
Best RaiMan (raimund-hocke) said :
#12

I made a faq, that should explain some of your doubts:
faq 2711

Revision history for this message
eduardobedoya (gonnabdh) said :
#13

Thanks RaiMan, that solved my question.

Revision history for this message
eduardobedoya (gonnabdh) said :
#14

tahnks so much RaiMan!

Revision history for this message
eduardobedoya (gonnabdh) said :
#16

In python there is a special function you can use... dir()
it shows all functions and variables that are store in a py file
I have notice that in Sikuli if I type... dir() doesn't show anything,
however if I type... print dir() it shows a lot of variables, I guess those are sikuli system variables.