There's got to be an easy way to do this

Steve Holden sholden at holdenweb.com
Thu Jul 5 15:20:11 EDT 2001


But "if x.isdigit()" might help speed it up (assuming 2.0 or later).

regards
 Ste e
--
http://www.holdenweb.com/


"Michael Ströder" <michael at stroeder.com> wrote in message
news:3B44B031.819C93E at stroeder.com...
> Emile van Sebille wrote:
> > Or (without re):
> > print "".join([x for x in '(123)/456-7890' if x in '0123456789'])
>
> I guess this one will be significantly slower for larger
> data sets than the re solution because of
>
>   if x in '0123456789'
>
> Ciao, Michael.





More information about the Python-list mailing list