← 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: Open => Answered

RaiMan proposed the following answer:
# using regular expression matching

import re

m = re.match("[^0-9]*([0-9]*\.?[0-9]*)", balance)
try:
    val = m.group(1)
except:
    val = -1
print val

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