Re: unescape escapes in strings

2009-02-23 Thread bvdp
Perfect ... thanks. >>> a = a.decode("string-escape") Using "string-escape" does the trick! Wonderful, this python. And the quick answers on this group. -- http://mail.python.org/mailman/listinfo/python-list

Re: unescape escapes in strings

2009-02-23 Thread MRAB
bvdp wrote: MRAB wrote: bvdp wrote: When reading lines of data from a file in the from (no quotes!) foo\x20bar and I assign to a variable in a line line like: f = file('infile', 'r') for a in f: print a the string is read in as string with the literal characters 'f', 'o' ... 'x'

Re: unescape escapes in strings

2009-02-23 Thread bvdp
MRAB wrote: bvdp wrote: When reading lines of data from a file in the from (no quotes!) foo\x20bar and I assign to a variable in a line line like: f = file('infile', 'r') for a in f: print a the string is read in as string with the literal characters 'f', 'o' ... 'x' , '2' ...

Re: unescape escapes in strings

2009-02-23 Thread MRAB
bvdp wrote: When reading lines of data from a file in the from (no quotes!) foo\x20bar and I assign to a variable in a line line like: f = file('infile', 'r') for a in f: print a the string is read in as string with the literal characters 'f', 'o' ... 'x' , '2' ... as compared t

unescape escapes in strings

2009-02-23 Thread bvdp
When reading lines of data from a file in the from (no quotes!) foo\x20bar and I assign to a variable in a line line like: f = file('infile', 'r') for a in f: print a the string is read in as string with the literal characters 'f', 'o' ... 'x' , '2' ... as compared to an assi