23 lines
539 B
Python
23 lines
539 B
Python
import random
|
|
import os
|
|
|
|
|
|
def generate_names(n):
|
|
"""
|
|
generates list of n random names
|
|
returns tuple(first, last)
|
|
"""
|
|
with open(
|
|
os.path.join(os.path.dirname(os.path.realpath(__file__)), "firstnames.txt")
|
|
) as f:
|
|
fs = f.read().split("\n")
|
|
with open(
|
|
os.path.join(os.path.dirname(os.path.realpath(__file__)), "lastnames.txt")
|
|
) as f:
|
|
ls = f.read().split("\n")
|
|
|
|
names = []
|
|
for i in range(n):
|
|
names.append((random.choice(fs), random.choice(ls)))
|
|
return names
|