Created
March 30, 2015 22:16
-
-
Save aaronlelevier/202871d21afeddc823cd to your computer and use it in GitHub Desktop.
Split a list using python and reformat it in a single column fomat
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
''' | |
To convert zipcodes | |
------------------- | |
From the output on: http://www.freemaptools.com/find-zip-codes-inside-radius.htm | |
to a list of strings to use as a filter in SQL. | |
Change data initially in this format: | |
1111,2222,3333 | |
To this format: | |
,'1111' | |
,'2222' | |
,'3333' | |
''' | |
with open('scottsdale_new.txt', 'w') as n: | |
with open('scottsdale.txt', 'r') as f: | |
for line in f: | |
zips = line.split(",") | |
for z in zips: | |
n.write(",'"+z+"'\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment