← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #645294]: error in reading Text file

 

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

    Status: Needs information => Answered

RaiMan proposed the following answer:
f.readlines() iterates over the lines in the file, but each line contains all characters including the linefeed (\n or \r\n).
strip() is the easiest way, to only get the text of the line, since it removes all whitespace characters  (https://en.wikipedia.org/wiki/Whitespace_character) from both ends of a line.

Hence, if you have more than one line in a file each line (except maybe
the last one) has a linefeed at the end.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.