[Tutor] removing whole numbers from text

Dinesh B Vadhia dineshbvadhia at hotmail.com
Sat Aug 2 17:51:55 CEST 2008


I want to remove whole numbers from text but retain numbers attached to words.  All whole numbers to be removed have a leading and trailing space.

For example, in "the cow jumped-20 feet high30er than the lazy 20 timing fox who couldn't keep up the 865 meter race." remove the whole numbers 20 and 865 but keep the 20 in jumped-20 and the 30 in high30er.

What is the best to do this using re?

Dinesh





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080802/8ee5256c/attachment.htm>


More information about the Tutor mailing list