← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #207655]: Need to pass input as file from user

 

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

Andrew Munro proposed the following answer:
In response to your question about looping values from a file, if you
get your input from configparser, why not just do in your config file:

sizeofdisk = 20, 30, 40

Then in sikuli:

def list_from_string(option, sep=',', chars=None):
    """Return a list from a ConfigParser option. By default, 
       split on a comma and strip whitespaces."""
    return [ chunk.strip(chars) for chunk in option.split(sep) ]

disksizes = list_from_string(config.get(vmsettings,disksizes)


'disksizes' will now return: [20,30,40] giving you your array of inputted disk sizes.

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