EOF while scanning triple-quoted string literal

Ian ian.g.kelly at gmail.com
Fri Oct 15 12:55:17 EDT 2010


On Oct 14, 10:30 pm, Lawrence D'Oliveiro <l... at geek-
central.gen.new_zealand> wrote:
> In message <op.vkfl1i1na8ncjz at gnudebst>, Rhodri James wrote:
>
> > ... frankly putting arbitrary binary into a literal string is rather
> > asking for something like this to come and bite you.
>
> It normally works fine on sensible OSes.

Which OSes would those be?  It doesn't work in Linux:

$ python -c "print 'print \'hello\0world\''" > test.py
$ cat test.py
print 'helloworld'
$ python test.py
  File "test.py", line 1
    print 'hello
               ^
SyntaxError: EOL while scanning string literal

Cheers,
Ian



More information about the Python-list mailing list