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

RaiMan proposed the following answer:
if you want to have 
[2, 0, 0, 0, 0, 0, 0, 0, 0, 0]

in your file
f.write(str(text))

this is what print does internally automatically (converting everything
into it's string representation if it is not a string.

If you want to have each value on a separate line, then writelines()
will not work in this case, since your vector does not contain strings,
but numbers. Moreover: writelines does not automatically add newlines.

this would write each value on a separate line:
f.writelines([str(x) + "\n" for x in text]) 

[str(x) + "\n" for x in text] is a so called list-comprehension, which
on the fly creates a new list based on the given receipt.

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to