Created
February 26, 2014 00:04
-
-
Save djds23/9220654 to your computer and use it in GitHub Desktop.
pull all 9 digit id numbers out of a text file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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