faker造数据

造数据 

from faker import Faker

fk = Faker(locale="zh-CN")

#姓名
name = fk.name()
print(name)

#身份证
id_card = fk.ssn()
print(id_card)
#手机号
phone = fk.phone_number()
print(phone)
#银行卡
card = fk.credit_card_number()
print(card)
#地址
addr = fk.address()
print(addr)

#邮箱
email = fk.email()
print(email)

#公司
company = fk.company()
print(company)

#公司邮箱
company_email = fk.company_email()
print(company_email)

#工作岗位
job = fk.job()
print(job)
#个人信息
# per = fk.profile()
per = fk.simple_profile()
print(per)
#随机数
res=fk.random_int(min=100,max=999)
print(res)
#生成一句话
res = fk.sentence()
print(res)
#生成一段文字
text = fk.text()
print(text)
#随机生成字符串
test_str = fk.pystr()
print(test_str)

#生成多个数据,保证数据不重复
result =[fk.unique.name() for i in range(10)]
print(result)
#年
year = fk.year()
this_year = fk.date_this_year()
# print(this_year)
#月
month = fk.month()
this_month = fk.date_this_month()
# print(this_month)
#精确到秒
date_time=fk.date_time()
# print(date_time)
#年月日
date_time = fk.date()
# print(date_time)

#指定时间范围  年月日
target__time = fk.date_between(start_date="-3y",end_date="today")
print(target__time)
#指定时间范围  年月日  时分秒
target__time_now = fk.date_time_between(start_date="-2y",end_date="now")
print(target__time_now)
#未来时间
future_date = fk.future_date()
# print(future_date)
future_date_time = fk.future_datetime()
print(future_date_time)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值