加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
utils.py 1.55 KB
一键复制 编辑 原始数据 按行查看 历史
thedestiny 提交于 2024-06-10 17:41 . save all
from faker import Faker
fak = Faker(locale="zh_CN")
if __name__ == '__main__':
print("faker !")
# -2m 2个月前
# today 今天
# -1y 一年前
# now 此刻
target_time_now = fak.date_time_between(start_date="-2y", end_date="-1y")
target_date = fak.date_between(start_date="-2y", end_date="-1y")
print("target_time_now ", target_time_now)
print("target_date ", target_date)
print("name ", fak.name())
print("digit ", fak.random_digit())
print("random int ", fak.random_int())
print("future date ", fak.future_date())
print("future datetime ", fak.future_datetime())
print("email ", fak.email())
print("address ", fak.address())
print("phone ", fak.phone_number())
print("company ", fak.company())
print("idcard ", fak.ssn(min_age=18, max_age=70))
print("bankcard ", fak.credit_card_number())
print("job ", fak.job())
print("text ", fak.text())
print("profile ", fak.profile())
print("datetime ", fak.date_time())
up_sql = """
UPDATE `tb_user` SET `user_id` = '{}', `username` = '{}', `email` = '{}', `cellphone` = '{}', `create_time` = '{}',
`update_time` = '{}' WHERE `id` = {};
"""
for pid in range(100):
print(up_sql.format(fak.random_int(min=10000, max=50000),
fak.name(),
fak.email(domain="163.com"),
fak.phone_number(),
fak.date_time_between(start_date="-2y", end_date="-1y"),
fak.future_datetime(), pid))
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化