22 lines
643 B
Python
22 lines
643 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
import random
|
|
from pathlib import Path
|
|
|
|
cur_dir = Path(os.path.abspath(__file__)).parent
|
|
|
|
# Noms et prénoms les plus fréquents en France:
|
|
NOMS = [x.strip() for x in open(cur_dir / "noms.txt").readlines()]
|
|
PRENOMS_H = [x.strip() for x in open(cur_dir / "prenoms-h.txt").readlines()]
|
|
PRENOMS_F = [x.strip() for x in open(cur_dir / "prenoms-f.txt").readlines()]
|
|
|
|
|
|
def nomprenom(sexe):
|
|
"""un nom et un prenom au hasard"""
|
|
if "e" in sexe.lower() or "f" in sexe.lower():
|
|
prenom = random.choice(PRENOMS_F)
|
|
else:
|
|
prenom = random.choice(PRENOMS_H)
|
|
return random.choice(NOMS), prenom
|