This is driving me batty!
In the interactive window, I can use string.replace on newlines for some
strings and not for others.
Here is what work for newlines:
bill at bill-laptop:~$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> test=r"a \n b \n c \n"
>>> test.replace(r"\n","***")
'a *** b *** c ***'
Yay! So far, so good. But now I put in a string with newlines, test2, using
the triple quote method :
>>> test2="""
... a
... b
... c
... """
>>> test2.replace(r"\n","***")
'\na\nb\nc\n'
>>> test2
'\na\nb\nc\n'
Boo! It does not work. So there here is my question: Why does test work but
test2 does not? (And: Why me?)
Thanks for any suggestions,
Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101023/11003171/attachment.html>