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

Lindstrom Greg - glinds Greg.Lindstrom at
Thu Jul 5 18:15:38 CEST 2001

I am reading in a phone number field and would like to throw away everything
except the digits.  Being an old C programmer, I know how I would do this.
Even with my limited knowledge of Python, I know how I would do it:

	for c in phone_number:
		if c in digits: 
			stripped_phone += c

but with all of the data structure support native to Python, I'm sure there
is "an obvious way" to do it (perhaps it's because I'm not Dutch:-).

Greg Lindstrom
Acxiom Corporation,                    mail: CWY10011149
InfoBase Products Development                  office: (501) 342-1626
301 Industrial Blvd, Conway, AR, 72032     fax:     (501) 336-3911 
email: Greg.Lindstrom at           

"When the solution is simple, God has spoken"

                                                            Albert Einstein

More information about the Python-list mailing list