> Jim Garrison (JG) wrote:
>JG> And as an interesting exercise, try
>JG> print r'test \'
>JG> print r'test \\'
>JG> Because of the way raw string parsing is defined, neither of these will
>JG> pass the parser. In fact, a raw string cannot have a backslash as
>JG> its last character.
Cannot
On May 24, 6:41 pm, grocery_stocker wrote:
> How come something like '\' causes an error? Here is what I mean.
>
> [cdal...@localhost ~]$ python
> Python 2.6.2 (r262:71600, May 3 2009, 17:04:44)
> [GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
> Type "help", "copyright", "credits" or "license
On 25 Maj, 05:29, Jim Garrison wrote:
> And as an interesting exercise, try
>
> print r'test \'
> print r'test \\'
>
> Because of the way raw string parsing is defined, neither of these will
> pass the parser. In fact, a raw string cannot have a backslash as
> its last character.
Tried it:
>>> r
On Sun, May 24, 2009 at 1:14 PM, grocery_stocker wrote:
> On May 24, 11:47 am, Hans Müller wrote:
>> Try this:
>>
>> print "\\"
>>
>> \ is the escape character, it masks the meaning of the next chararcter.
>>
>> If you write print "\" python tries to print " (the meaning of " as
>> the string del
And as an interesting exercise, try
print r'test \'
print r'test \\'
Because of the way raw string parsing is defined, neither of these will
pass the parser. In fact, a raw string cannot have a backslash as
its last character.
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 24 May 2009 21:14:44 +0100, grocery_stocker
wrote:
On May 24, 11:47 am, Hans Müller wrote:
Try this:
print "\\"
\ is the escape character, it masks the meaning of the next chararcter.
If you write print "\" python tries to print " (the meaning of " as
the string delimiter is beei
On May 24, 11:47 am, Hans Müller wrote:
> Try this:
>
> print "\\"
>
> \ is the escape character, it masks the meaning of the next chararcter.
>
> If you write print "\" python tries to print " (the meaning of " as
> the string delimiter is beeing masked) and finds no closing "
> This is why you g
Try this:
print "\\"
\ is the escape character, it masks the meaning of the next chararcter.
If you write print "\" python tries to print " (the meaning of " as
the string delimiter is beeing masked) and finds no closing "
This is why you got the error.
hth.
Greetings
Hans
--
http://mail.pyth
'\' starts a escape sequence. You need to escape '\' with a '\' to make it
work.
>>> print 'test \\'
test \
--
http://mail.python.org/mailman/listinfo/python-list
How come something like '\' causes an error? Here is what I mean.
[cdal...@localhost ~]$ python
Python 2.6.2 (r262:71600, May 3 2009, 17:04:44)
[GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print "test \"
File "", l
10 matches
Mail list logo