TGViewer
Learn Python Coding Learn Python Coding @pythonre Β· 40.8K subscribers
Post #9064 1.46K

Forwarded from Remote Jobs β€” Daily LinkedIn Picks πŸ’Ό

πŸ”₯ Generating fake data in Python β€” no pain at all

If you're testing forms, mockups, or just want to play with data, there's Mimesis β€” a generator of fake data. Names, emails, addresses, and phone numbers. There's a location setting that allows you to select a country, and the data will be generated accordingly.

πŸ“¦ Installation:
from typing import Dict
from mimesis.enums import Gender
from mimesis import Person

def generate_fake_user(locale: str = "es", gender: Gender = Gender.MALE) -> Dict[str, str]:
    """
    Generates fake user data based on the locale and gender.

    :param locale: The locale (for example, 'ru', 'en', 'es')
    :param gender: The gender (Gender.MALE or Gender.FEMALE)
    :return: A dictionary with the fake user data
    """
    person = Person(locale)

    user_data = {
        "name": person.full_name(gender=gender),
        "height": person.height(),
        "phone": person.telephone(),
        "occupation": person.occupation(),
    }

    return user_data

if __name__ == "__main__":
    fake_user = generate_fake_user(locale="es", gender=Gender.MALE)
    print(fake_user)


πŸ“Œ Result:
{
  'name': 'Carlos Herrera',
  'height': '1.84',
  'phone': '912 475 289',
  'occupation': 'Arquitecto'
)


⚑️ Mimesis can:
πŸ–± Generate names, addresses, phone numbers, professions, etc. 
πŸ–± Work with different countries (πŸ‡·πŸ‡Ί ru, πŸ‡ΊπŸ‡Έ en, πŸ‡ͺπŸ‡Έ es, etc.) 
πŸ–± Suitable for tests, fake accounts, demo data in projects, and bots.

βš™οΈ GitHub/Instructions

Save it, it'll come in handy πŸ‘

#python #github #interview
  • ❀ 7
More from @pythonre
  1. Oct 14, 2026Build AI Agents with Google ADK: Gemini, Memory & Vertex AI Build production-ready AI agen…
  2. Oct 13, 2026https://substack.com/@husseinsheikho?utm_source=share&utm_medium=android&r=3hwnr8 Follow m…
  3. Oct 10, 2026πŸ“š Download 10 Python books for FREE: 1. Think Python β€” O’Reilly https://t.co/X7y3pX68IW 2…
  4. Oct 7, 2026Python Lists: A Quick Reference 🐍 * Definition: Lists are ordered, mutable collections th…
  5. Oct 7, 2026πŸ“± 270 tools for Python developers The repository contains: 🫑 Linters and formatters; πŸ«‘β€¦
  6. Oct 7, 2026Hands On Python Data Science - Data Science Bootcamp Master Python for Data Science with R…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook β†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 β†’