Newbie - help in opening and reading a file from >>>

QuestionExchange USENET at questionexchange.com
Fri Mar 31 08:32:16 EST 2000


Dan wrote:

   I've just installed 1.5 on my Windows 98Se system
   I'm trying to execute the following-
   >>>f=open('C:\Autoexec.bat')
   and I get a no such directory or file error
The backslash is a special character in literal strings
in python.  It and the character(s) following it are
interpreted as a special character.  To enter a backslash
in a string in python code, type two backslashes.
f=open("c:\\Autoexec.bat")
A full list of these special string codes can be found at:
http://www.python.org/doc/current/ref/strings.html

-- 
  This answer is courtesy of QuestionExchange.com
  http://www.questionexchange.com/servlet3/qx.usenetGuest.showUsenetGuest?ans_id=12477&cus_id=USENET



More information about the Python-list mailing list