Click to See Complete Forum and Search --> : Python: Stripping chars from a string...


tidilipom
05-01-2001, 04:51 PM
Yeah the topic says it all I guess :)
Im kinda new to python and want to know a quick and dirty way to strip certain characters from a string...

Thanks.

Ben Briggs
05-01-2001, 08:40 PM
Regular Expressions... it's the 're' module. I'm not familiar with Regular Expressions, but I know you'll have to substitute the character(s) that you want stripped the an empty string.

[ 01 May 2001: Message edited by: Ben Briggs ]

jemfinch
05-01-2001, 11:00 PM
If it's just certain characters, you can do several string.replace()s, or a single re.sub() with the proper character class.

Jeremy