Created
June 16, 2014 03:30
-
-
Save rschiang/8cad674bb41160062c05 to your computer and use it in GitHub Desktop.
Batch process zip code
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
#!/usr/bin/python | |
# sudo pip install zipcodetw | |
from codecs import open | |
import zipcodetw | |
i = open('address.txt', 'r', encoding='utf-8') | |
o = open('address_a.txt', 'w+', encoding='utf-8') | |
for addr in i: | |
o.write('%s %s\n' % (zipcodetw.find(addr), addr)) | |
i.close() | |
o.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment