使用Faker生成随机的中文图书标题
发布时间:2024-01-01 15:21:39
import random
from faker import Faker
fake = Faker('zh_CN')
for _ in range(1000):
book_title = fake.sentence(nb_words=random.randint(2, 6))
book_title = book_title.strip('.')
print(f"图书标题:{book_title}")
example = fake.text(max_nb_chars=50)
print(f"使用例子:{example}
")
