Home » Generate data using Mimesis in Python

Generate data using Mimesis in Python

by maxguy71

Mimesis is a fake data generator for Python, which provides data for a variety of purposes in a variety of languages.

The fake data can be used to populate for a wide range of testing.

Features

Supports data for a lot of languages.
The fastest data generator available for Python.
Supports a lot of data providers for a variety of purposes.
Provides data specific only for some countries.
You can create your own data providers and use them with Mimesis.
Does not require any modules other than the Python standard library.

Locales

Mimesis currently includes support for 34 different locales. You can specify a locale when creating providers and they will return data that is appropriate for the language or country associated with that locale.

>>> from mimesis import Person
>>> from mimesis.locales import Locale
>>> from mimesis.enums import Gender

>>> de = Person(locale=Locale.DE)
>>> en = Person(locale=Locale.EN)

Installation

To install mimesis using pip:

pip install mimesis

Code Examples

from mimesis import Person
person = Person()

print (person.full_name())
print (person.academic_degree())
print (person.age())
print (person.blood_type())
print (person.email())
print (person.gender())
print (person.height())
print (person.language())
print (person.nationality())
print (person.occupation())
print (person.telephone())
print (person.weight())
print (person.username())
from mimesis import Address
address = Address()

print (address.address())
print (address.city())
print (address.country())
print (address.country_code())
print (address.postal_code())
print (address.prefecture())
print (address.province())
print (address.region())
print (address.state())
print (address.street_name())
print (address.street_suffix())
print (address.zip_code())
from mimesis import Transport
transport = Transport()

print (transport.airplane())
print (transport.car())
print (transport.manufacturer())
print (transport.truck())
print (transport.vehicle_registration_code())
from mimesis import Hardware
hardware = Hardware()

print (hardware.cpu())
print (hardware.cpu_codename())
print (hardware.cpu_frequency())
print (hardware.cpu_model_code())
print (hardware.graphics())
print (hardware.manufacturer())
print (hardware.phone_model())
print (hardware.ram_size())
print (hardware.resolution())
print (hardware.screen_size())
print (hardware.ssd_or_hdd())
from mimesis import Text
text = Text()

print (text.alphabet())
print (text.answer())
print (text.color())
print (text.hex_color())
print (text.level())
print (text.quote())
print (text.rgb_color())
print (text.sentence())
print (text.text())
print (text.title())
print (text.word())
print (text.words())
from mimesis import Text
text = Text()

i = 1
while i < 6:
  print (text.words())
  i += 1

You may also like

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More