Last active
August 29, 2015 13:56
-
-
Save relsqui/9287464 to your computer and use it in GitHub Desktop.
Generate random fake Portland housing listings.
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
relsqui@raven:~$ for i in `seq 10`; do ./generate_listing.py; done | |
2220|2725|2|northeast|good schools|nice view|vaults| | |
1120|2958|1|southeast|quiet neighborhood|non-smoking|two-car garage| | |
1445|1579|1|Clackamas|cats ok|close to parks|quiet neighborhood| | |
1070|1330|2|St. Helens|gated property|close to shopping|close to parks| | |
1300|2595|4|Lake Oswego|quiet neighborhood|close to shopping|pool| | |
1810|2119|4|Hillsboro|cats ok|close to campus|laundry on-site| | |
1080|857|4|north Portland|duplex|fireplace|close to campus| | |
1960|3952|1|Vancouver|cats ok|quiet neighborhood|pool| | |
1720|1499|0|southwest|laundry on-site|close to shopping|fireplace| | |
2550|3959|2|St. Johns|good schools|gated property|one-car garage| |
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
fenced yard | |
non-smoking | |
cats ok | |
dogs ok | |
one-car garage | |
two-car garage | |
gated property | |
manufactured home | |
acreage | |
vaults | |
fireplace | |
deck | |
close to transit | |
close to campus | |
close to shopping | |
close to parks | |
laundry on-site | |
pool | |
quiet neighborhood | |
nice view | |
duplex | |
manager on-site | |
good schools |
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 | |
from random import choice, randrange | |
with open("locations.txt") as f: | |
locations = f.readlines() | |
with open("features.txt") as f: | |
features = f.readlines() | |
feat = [0, 0, 0] | |
while (feat[0] == feat[1] or feat[1] == feat[2] or feat[2] == feat[0]): | |
feat = [choice(features).strip(), choice(features).strip(), | |
choice(features).strip()] | |
print("{}|{}|{}|{}|{}|".format(randrange(180, 600) * 5, randrange(800, 5000), | |
randrange(0, 5), choice(locations).strip(), | |
"|".join(feat))) |
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
southwest | |
southeast | |
north Portland | |
northeast | |
northwest | |
Lake Oswego | |
Clackamas | |
Gresham | |
St. Helens | |
St. Johns | |
Vancouver | |
Hillsboro | |
Beaverton |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment