Thanks for all the help, everyone - the raw string solution seems the most practical, and it raises one final question: If I define a string x = "c:\python23\programs\test.txt" How can I force open() or file() to treat it as a raw string. I expect to use a command of the form open(rx) or open(r"x") or open("r"+x) but none of these forms work.