from faker import Faker
import json
fake = Faker()
def generate_user_profile():
return {
"name": fake.name(),
"email": fake.email(),
"username": fake.user_name(),
"password": fake.password(length=12),
"birth_date": fake.date_of_birth(minimum_age=18, maximum_age=80).isoformat(),
"address": {
"street": fake.street_address(),
"city": fake.city(),
"state": fake.state(),
"zip_code": fake.zipcode(),
"country": fake.country()
},
"phone_number": fake.phone_number(),
"job": fake.job(),
"company": fake.company(),
"credit_card": {
"number": fake.credit_card_number(),
"expiry": fake.credit_card_expire(),
"security_code": fake.credit_card_security_code()
}
}
# Generate 5 user profiles
user_profiles = [generate_user_profile() for _ in range(5)]
# Print the generated profiles
print(json.dumps(user_profiles, indent=2))
Click Run or press shift + ENTER to run code