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: b...@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
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor