Skip to content

Instantly share code, notes, and snippets.

@abhiomkar
Created March 24, 2011 19:43
Show Gist options
  • Save abhiomkar/885716 to your computer and use it in GitHub Desktop.
Save abhiomkar/885716 to your computer and use it in GitHub Desktop.
Parse Mobile Numbers (10 Digits) from Text File. PS: Regex is very lame in this code.
import re
db_txt = open('~/Downloads/phone_database.txt').read()
ph_str = '\r\n'.join(re.findall('\d{10}', db_txt)
open('/tmp/ph_numbers.txt', 'w').write(ph_str)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment