How to remove "\n" in a string?

Isaac To kkto at csis.hku.hk
Thu Sep 20 06:49:05 EDT 2001


>>>>> "rainlet" == rainlet  <orrego at mail2000.com.tw> writes:

    rainlet> I tried : s = ".............."  s.replace ( "\n", "" )

    rainlet> But it doesn't seem to work.

If you remember that strings are immutable, you'd probably have written
s = s.replace(...), which should do the trick.

Regards,
Isaac.



More information about the Python-list mailing list