Skip to content

Instantly share code, notes, and snippets.

@aheld
Last active December 16, 2015 11:49
Show Gist options
  • Save aheld/5430013 to your computer and use it in GitHub Desktop.
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
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