faker库的使用

faker 库的安装

这是个神奇的类库, 它可用来产生虚假的模拟数据。

pip install faker -i https://mirrors.163.com/pypi/simple
(我是在VScode中执行的安装命令,结果如下:)

Collecting faker Downloading
https://mirrors.163.com/pypi/packages/0a/ec/97397fbb5f17c9bb571bab49f939b973ef79729e929449630b0ca771396a/Faker-9.8.2-py3-none-any.whl
(1.2 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 903.4
kB/s eta 0:00:00Requirement already satisfied: python-dateutil>=2.4 in
c:\users\gym\appdata\roaming\python\python311\site-packages (from
faker) (2.8.2)Collecting text-unidecode==1.3 Downloading
https://mirrors.163.com/pypi/packages/a6/a5/c0b6468d3824fe3fde30dbb5e1f687b291608f9473681bbf7dabbf5a87d7/text_unidecode-1.3-py2.py3-none-any.whl
(78 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.2/78.2 kB
722.5 kB/s eta 0:00:00Requirement already satisfied: six>=1.5 in c:\users\gym\appdata\roaming\python\python311\site-packages (from
python-dateutil>=2.4->faker) (1.16.0)Installing collected packages:
text-unidecode, fakerSuccessfully installed faker-9.8.2
text-unidecode-1.3PS D:\doing\python\core>

from faker import Faker

faker = Faker()  
faker2 = Faker('zh_CN')
print(faker.name())
print(faker.address())
print(faker.phone_number())


print(faker2.name())
print(faker2.address())
print(faker2.phone_number())

Michael Richardson 168 Morrison Mount Jameschester, OK 55312
(108)552-6357x9244 袁玲 福建省丽丽市浔阳阜新路S座 313037 18799938872

你可能感兴趣的:(python,python,开发语言)