[New-bugs-announce] [issue12685] The backslash escape doesn't concatenate two strings in one in the with statement

py.user report at bugs.python.org
Wed Aug 3 05:40:57 CEST 2011


New submission from py.user <port139 at yandex.ru>:

>>> with open('/etc/passwd') as f1, \
...      open('/etc/profile) as f2:
  File "<stdin>", line 2
    open('/etc/profile) as f2:
                             ^
SyntaxError: EOL while scanning string literal
>>>

>>> with open('/etc/passwd') as f1,          open('/etc/profile') as f2:
...

working example for a loop:

>>> for i, j in zip(range(10), \
...                 range(5, 15)):
...   print(i, j)
... 
0 5
1 6
2 7
3 8
4 9
5 10
6 11
7 12
8 13
9 14
>>>

>>> for i, j in \
...             zip(range(10), range(5, 15)):
...   print(i, j)
... 
0 5
1 6
2 7
3 8
4 9
5 10
6 11
7 12
8 13
9 14
>>>

----------
components: Interpreter Core
messages: 141596
nosy: py.user
priority: normal
severity: normal
status: open
title: The backslash escape doesn't concatenate two strings in one in the with statement
type: behavior
versions: Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12685>
_______________________________________


More information about the New-bugs-announce mailing list