← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #272186]: double backslashes in printed strings --- is by convention (a \ must be escaped with a \ )

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
this works with version 1.1.0 on Windows 10 64 with Java 8 (should work
on Win7, 8 and Java 7 too):

data = u"c:\SikuliX\依頼分\sikuli.funcあ.txt"
dir = os.path.dirname(data)
uprint("*** content of " + dir)
for fname in os.listdir(dir):
  uprint(fname)
uprint("*** content of " + data)
ftxt = open(data)
for line in ftxt.readlines():
  uprint(line.strip())

... and prints out:
*** content of c:\SikuliX\依頼分
sikuli.funcあ.txt
*** content of c:\SikuliX\依頼分\sikuli.funcあ.txt
sikuli.funcあ line 1
sikuli.funcあ line 2
sikuli.funcあ line 3

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