def justPolish(): global polish outFile = open(datadir + "bars.sql", "w") outFile.write("INSERT INTO Bar (`name`, `phone`, `city`, `state`, `latitude`, `longitude`, `license`, `international`) VALUES ") first = True for i in polish: name = i license = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(10))#stolen from stackoverflow randPlace = cities.getCity() city = randPlace[0] state = randPlace[1] lat = randPlace[2] lon = randPlace[3] randPhone = "%i-%i-%i" % (random.randint(100,999),random.randint(100,999), random.randint(1000,9999)) if not first: outFile.write(",") else: first = False outFile.write("(\"%s\", \"%s\", \"%s\", \"%s\", %f, %f, \"%s\", 1)" % (name, randPhone, city, state, lat, lon, license)) outFile.write("\n") outFile.close() print("Done -- output in " + datadir + "bars.sql")
firstNum = random.randint(0,len(first)-1) while True: if first[firstNum][0]=="F": firstNum = random.randint(0,len(first)-1) else: break usedLastNames.append(lastNum) randFirst = first[firstNum][2] randGender = first[firstNum][0] randLast = last[lastNum] if randGender=="F": females = females-1 randAge = random.randint(17,80) randPhone = "%i-%i-%i" % (random.randint(100,999),random.randint(100,999), random.randint(1000,9999)) randStreet = "%i %s %s" % (random.randint(1,600), getStreet(randFirst), stAbbr[random.randint(0,len(stAbbr)-1)]) randPlace = cities.getCity() city = randPlace[0] state = randPlace[1] lat = randPlace[2] lon = randPlace[3] if not first: outFile.write(",") else: first = False print "%i. %s %s [%s] Age: %i Phone: %s Addr: %s" % (i,randFirst, randLast,randGender,randAge, randPhone, "%s, %s, %s [%0.3f, %0.3f]" % (randStreet, city, state, lat, lon)) outFile.write("(\"%s\", \"%s\", \"%s\", \"%s\", %f, %f, \"%s\", %d, \"%s\")" % (randFirst + " " + randLast, randPhone, city, state, lat, lon, randGender, randAge, randStreet)) outFile.write("\n") outFile.close() print "Done"