[Tutor] Backslashes inside of variable
Phoebus
phoebus@fastmail.fm
Thu, 16 May 2002 17:05:08 -0400
I am running Python 2.2 on Win2k. I have a program which writes a
filename, with backslashes to a file, along with other stuff. I read
the file in using readlines() and put each line into a variable.
My problem is I want to use the filename, but I can't use it because of
the backslashes. I know about doing open(r"d:\test\file.txt","w") or
even open(`d:\test\file.txt`,"w"), but the filename is inside of a
variable so when I do open(filename,'w'), I have problems.
Can anyone help?
Thanks,
Steve
--