Last active
December 16, 2015 11:49
-
-
Save aheld/5430013 to your computer and use it in GitHub Desktop.
Random Philly addresses, python style You need to pip install names for this to work
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 random | |
import names | |
streets = "Vine,Race,Cherry,Arch,John F Kennedy Boulevard,Market,Chestnut,Sansom,Walnut,Locust,Spruce,Pine,Lombard,South".split(',') | |
second = "suite,apartment,unit".split(',') | |
def gen2(): | |
if random.randrange(100) <= 30: | |
return "%s #%s" % (random.choice(second), random.randrange(20)) | |
else: | |
return "" | |
def fakeAddress(): | |
return {"name" : names.get_full_name(), | |
"address1": "%s %s" % (random.randrange(500), random.choice(streets)), | |
"address2": gen2(), | |
"city": "Philadelphia", | |
"state": "PA", | |
"zipcode": "191%02d" % (random.randrange(50)) | |
} | |
if __name__ == "__main__": | |
import pprint | |
pprint.pprint(fakeAddress()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment