[Newbie Q on String & List Manipulation]
David Eppstein
eppstein at ics.uci.edu
Fri Apr 16 02:23:38 EDT 2004
In article <567a7c35.0404152154.1645e79d at posting.google.com>,
matthew at coredumps.net (Matthew) wrote:
> finally, i found a way to make to a+=b works,
> but, i don't understand why it works... ;(
I was seeing a lot of newline (^M) characters at the ends of the strings
you posted. When you concatenate them together then output them, the ^M
may cause the lines to overwrite each other causing you to think you're
only seeing the last one. But repr turns these characters into a
sequence of two characters, backslash followed by r. Is this your
problem? If so, maybe you want to call strip() on your strings before
concatenating or joining them?
--
David Eppstein http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science
More information about the Python-list
mailing list