Created
June 18, 2012 14:48
-
-
Save dandye/2948732 to your computer and use it in GitHub Desktop.
Search for FIPS codes and create files_list.txt files.
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 os,sys | |
import re | |
counties = [x.strip() for x in open("/mnt/tiger/counties_fips_list.txt").readlines()] | |
for county in counties: | |
of = open("/mnt/tiger/TIGER2011/wg_fips/tl_2011_{}/files_list.txt".format(county),"w") | |
for threetuple in os.walk("/mnt/tiger/TIGER2011/"): | |
for filename in threetuple[-1]: | |
if county in os.path.join(threetuple[0],filename): | |
of.write(os.path.join(threetuple[0],filename)+"\n") | |
of.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment