← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #192615]: How to call variable in type or paste methods?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Since I am RaiMan, I have to say: 
This is basic Python scripting (if you want to do more complex stuff, you have to learn the basics).
Have a look at the docs.

But since I am RaiMan, I give you some start ;-)

f=open('C:/folder/filename.txt')
var = f.read(1) # reads one byte (empty string at eof)
# var = f.read() # var contains the whole file content
# var = f.readline() # var contains the next line incl. line end
# var = f.readlines() # var is a list and contains all lines  
paste(var)

to further process var after reading use the string functions like
strip(), split(), ...

The basic file operations expect plain ASCII files. If file content is
UTF-8 coded, you have to use the respective codec.

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