[Tutor] removing whole numbers from text

Alan Gauld alan.gauld at btinternet.com
Sat Aug 2 19:04:00 CEST 2008


"Dinesh B Vadhia" <dineshbvadhia at hotmail.com> wrote

> I want to remove whole numbers from text but retain numbers
> attached to words.

Is this a homework?
If so we can only offer suggestions to direction but not give 
solutions.

> What is the best to do this using re?

Yes, use re to define a pattern then use sub() to replace with
an empty string

Alan G.






--------------------------------------------------------------------------------


> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 




More information about the Tutor mailing list