简体   繁体   中英

Generating chinese/pinyin names

I am trying to generate random chinese names using Faker (Python), but it generates the names in chinese characters instead of pinyin.

I found this:

from faker import Faker

fake = Faker("zh_CN")

fake.name()
# Wu Shuai

fake.address()
# Huangpuwei Road, Xiashi, Shangai R seat 196165

and it show that it generates them in pinyin, while when I try the same code, it gives me only chinese characters.

How can I get the pinyin?

fake.romanized_name() worked for me.

I got lucky by looking through dir(fake) . Doesn't seem to have a method for pinyin address that I can see...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM