Generate Fake Names in Python

Fake is a handy Python package that generates fake names, addresses, and text.

Github – Faker

Install Faker

The simplest way to install Faker is by using pip

pip install Faker 

Examples

Here’s a few examples to get you started. The project’s github page has lots of more advanced code snippets if you decide

Print 10 names to the console

import faker
from faker import Faker
fake = Faker()
    for i in range(10):
    print(fake.name())

# Console Output
> 'Rodney Johnston'
> 'Ryan Watson'
> 'Daniel Doyle'
> 'Kevin Hancock'
> 'Amber Arnold'
> 'Sherri Brooks'
> 'Lori Maldonado'
> 'Stacy Callahan'
> 'Valerie Klein'
> 'Kristen Wallace'

Save 10 names to a list

import faker
from faker import Faker

fake_names = [fake.name() for i in range(10)]

print(fake_names[4])

#Console Output 
> 'Craig Taylor'


Print a fake address to the console

print(fake.address())

# Console Output 
> 469 William Vista
> East Edward, AR 70966