On Apr 17, 2:09 am, ragia <[EMAIL PROTECTED]> wrote: > hi > i have to match text string char by char to a regular expressions tht > just allow digits 0-9 if other thing a ppear it shall be replaced with > space.how can i do that any help? > so far i have the string and can read it using a for loop...but how to > match each char with the regular expressions and save the result into > other string or replace it with space in that other string to have new > one.. > I a new in python ,thatnks in advance
>>> import re # Python's library supporting regexps >>> >>> string = "abc123def456" >>> re.sub("\D", " ", string) ' 123 456' ~~Sosuke~~ -- http://mail.python.org/mailman/listinfo/python-list