Help needed - function apparently global cannot be called.

Stefan Schwarzer sschwarzer at sschwarzer.net
Tue Sep 7 16:01:42 EDT 2010


Hi Ian,

On 2010-09-07 12:18, Ian Hobson wrote:
>      f = open('d:\logfile.txt','a')

Just a note: Using a backslash in a non-raw string will get
you in trouble as soon as the backslash is followed by a
character which makes a special character sequence, like "\n".
For example,

f = open('d:\nice_filename.txt', 'a')

will give surprising results. :-) Either double the
backslash, use a raw string, or, in the special case of
file system paths, possibly use a forward slash.

Stefan



More information about the Python-list mailing list