mercredi 1 avril 2020

python. Generate random data for sqlite3

What is the best approach to generate random data for sqlite3, preferably using python, but not obligatory?

Currently, my code looks like this and this is pretty ugly.

def add(update, context): 
    user_ids = [381168, 218637, 012649]  # Really users, fake data
    for user_id in user_ids:
        user_dict = {'gender': random.choice(['парень', 'девушка']),
                     'age': random.randint(10, 60) }
        insert_user(user_id, user_dict, context.chat_data.get('photos', list()))



Aucun commentaire:

Enregistrer un commentaire