← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #187286]: How get tuple name ?

 

Question #187286 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/187286

    Status: Open => Answered

RaiMan proposed the following answer:
globals().items() is a tuple like:
( (name1, content), (name2, content), ... )
where nameX is a string containing the name of the globally defined object and content is its real current content.

so this should find your tuple:

myTuple = ()
searchedName =  "myTuple"
found = None

for k,v in globals().items(): 
    if isinstance(v, tuple) and k == searchedName:
        found = v
        print k, "=", v
        break

if found == None:
    print searchedName, "not found"

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.