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

Sam Penrose sam at ddmweb.com
Fri Jul 6 13:33:03 EDT 2001


One assumption in this thread is that non-numerical data lacks
syntactic significance. This is not always the case. Dealing with a real
database of 30,000+ customer phone numbers, I discovered such
variations as: 321-8765 ext 991
--a local phone number with an extension. Y'all would convert that into
an area code plus seven, generating a possibly valid but useless phone
number and destroying real data. I wrote a short script to take out
only whitespace, parentheses, and hyphens and examine the result. If it
looked like a 7 or 10-digit phone number, I displayed it as
such--otherwise I didn't touch it.

You may know that your input contains no such entries, of course. Or
international numbers. Or other special cases I haven't thought of.




More information about the Python-list mailing list