string substitutions
Sheila King
usenet at thinkspot.net
Sat Feb 23 17:33:24 EST 2002
More information about the Python-list mailing list
Sat Feb 23 17:33:24 EST 2002
- Previous message (by thread): string substitutions
- Next message (by thread): string substitutions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, 23 Feb 2002 16:20:54 -0500, "Mike C. Fletcher" <mcfletch at geocities.com> wrote in comp.lang.python in article <mailman.1014499369.29333.python-list at python.org>: > >>> import string > >>> data = 'this\n\nthose\n\n\nthem\ntheir\nthose' > >>> string.join(filter( None, string.split( data, '\n')), '\n') > 'this\nthose\nthem\ntheir\nthose' > >>> Thanks for the suggestion. I really should have thought of that myself. But there are so many different aspects to this script that I'm working on, that sometimes something simple like this, I just want to "get done" and work on the other "harder" stuff. Your method is much better. I happen to be working on this script right now, and will incorporate this change. Thanks for the suggestion, -- Sheila King http://www.thinkspot.net/sheila/ "When introducing your puppy to an adult cat, restrain the puppy, not the cat." -- Gwen Bailey, _The Perfect Puppy: How to Raise a Well-behaved Dog_
- Previous message (by thread): string substitutions
- Next message (by thread): string substitutions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list