The faker library in Python
Installing faker:
pip install faker
Generating Fake Names:
from faker import Faker
# Create a Faker object
faker = Faker()
# Generate a fake name
fake_name = faker.name()
print("Fake Name:", fake_name)
#clcoding.com
Fake Name: Anthony Ortiz
Generating Fake Addresses:
from faker import Faker
# Create a Faker object
faker = Faker()
# Generate a fake address
fake_address = faker.address()
print("Fake Address:", fake_address)
#clcoding.com
Fake Address: 098 Parker Burg Suite 277
Olsonborough, IN 35433
Generating Fake Email Addresses:
from faker import Faker
# Create a Faker object
faker = Faker()
# Generate a fake email address
fake_email = faker.email()
print("Fake Email Address:", fake_email)
#clcoding.com
Fake Email Address: choward@example.com
Generating Fake Text:
from faker import Faker
# Create a Faker object
faker = Faker()
# Generate fake text
fake_text = faker.text()
print("Fake Text:\n", fake_text)
#clcoding.com
Fake Text:
Election huge event. Remember go else purpose specific detail position eight. High project outside quickly try research.
Degree affect detail together. Way company along relate set.
Generating Fake Dates:
from faker import Faker
# Create a Faker object
faker = Faker()
# Generate a fake date
fake_date = faker.date_of_birth()
print("Fake Date of Birth:", fake_date)
#clcoding.com
Fake Date of Birth: 1950-10-06
Generating Fake User Profiles:
from faker import Faker
# Create a Faker object
faker = Faker()
# Generate a fake user profile
fake_profile = faker.profile()
print("Fake User Profile:", fake_profile)
#clcoding.com
Fake User Profile: {'job': 'Insurance claims handler', 'company': 'Mitchell-Martinez', 'ssn': '590-06-5154', 'residence': '90056 Medina Brooks\nMeyermouth, AK 19255', 'current_location': (Decimal('25.254868'), Decimal('19.597316')), 'blood_group': 'B+', 'website': ['https://johnson-bentley.com/', 'https://stevenson.com/'], 'username': 'qparker', 'name': 'Jay Sims', 'sex': 'M', 'address': '6742 Moore Fields\nMartinton, ME 47664', 'mail': 'fmiranda@hotmail.com', 'birthdate': datetime.date(1985, 8, 7)}
0 Comments:
Post a Comment