← Back to team overview

sikuli-driver team mailing list archive

[Question #244224]: Usage of dictionary/arrays

 

New question #244224 on Sikuli:
https://answers.launchpad.net/sikuli/+question/244224

I need help on the below code:

In the libary function, declaring as below:
def test_details(option):
    details={
        "test1": {
                            "ip": "10.10",
                            "string": "TESTING",
                            },
        "test2": {
                            "ip": "10.20",
                            "string": "TESTING2",
                            },
                        }
for ip, list in test_details.iteritems():
        if option in list: return ip

In the main function,declaring only 'option' variable as:
option =" test1"
t=lib.test_details(option["ip"])
print(t)

when i am running the above code, it is giving as error as "ip is not declared".
But i don't want to decalre 'ip' as individually again, whereever i want 'ip' value then it should check above list respective with option(test1 or test2) and it should print the value directly .
Similarly i want to type only string value but not ip value in some places ?

Thank you,
Sudha.

    



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