Remove some characters from a string

Julien jphalip at gmail.com
Thu Jul 17 10:13:21 CEST 2008


Hi,

I can't seem to find the right regular expression to achieve what I
want. I'd like to remove all characters from a string that are not
numbers, letters or underscores.

For example:

>>> magic_function('si_98%u^d at .as-*gf')
str: 'si_98udasgf'

Would you have any hint?

Thanks a lot!

Julien



More information about the Python-list mailing list