← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #232183]: [How To] set variable value from OCR numerics

 

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

    Status: Solved => Open

Phillip Kelly is still having a problem:
I have another small problem because I don't fully understand how to use global and local variables properly.
When I try to pass the decoded balance to a global variable it fails and remains defined by the local function variable.

val = 0
result = 0

def readbalance( balance ):
    import re
    m = re.match("[^0-9]*([0-9]*\,?[0-9]*\.?[0-9]*)", balance)
    val = m.group(1)
    result = val
    print val
    print result
    return

Although I have defined both val and result as gobal variables, the function definition defines additional local variables with similar names.
How do I pass the decoded local variable "val" to a global variable such as "result" ?

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