Hi ππ
Welcome in new post, today i will share with you How to Generates fake data In Python and module called Faker
Faker is a Python package that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to stress test it, or anonymize data taken from a production service, Faker is for you.
Install it from here : pip install Faker
Examples of how to use
Generate fake names
from faker import Faker
fake = Faker()
print(fake.name())
Generate fake address
from faker import Faker
fake = Faker()
print(fake.address())
Generate fake ipv4
from faker import Faker
from faker.providers import internet
fake = Faker()
fake.add_provider(internet)
print(fake.ipv4_private())
Generate fake emails
from faker import Faker
fake = Faker()
print(fake.email())
from faker import Faker
fake = Faker('it_IT')
for _ in range(10):
print(fake.name())
result
Marina Cuomo
Ludovica Bocca
Sig.ra Isabella Aporti
Antonietta Zeffirelli-Carnera
Agostino Cortese
Sig.ra Laura Chittolini
Sig. Geronimo Ferragni
Piergiorgio Sorrentino
Mariano Goldstein
Erika Vercelloni
For more info : https://pypi.org/project/Faker/
Now we're done π€
Don't forget to like and follow π
Support me on PayPal π€
https://www.paypal.com/paypalme/amr396
Top comments (0)