Skip to content

Instantly share code, notes, and snippets.

@djds23
Created February 26, 2014 00:04
Show Gist options
  • Save djds23/9220654 to your computer and use it in GitHub Desktop.
Save djds23/9220654 to your computer and use it in GitHub Desktop.
pull all 9 digit id numbers out of a text file
import re
with open('ids.txt', 'r') as f:
data = f.read()
sort = [ anid for and in re.findall(r'[0-9]{9}', data)]
with open('newids.txt', 'w') as nl:
for anid in sort:
nl.write(anid)
nl.write('\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment