I have nothing to do after get off work to join in the fun and tell me my thoughts on this problem and my code copying records
1. In order to make the generated name look like a first name, as mentioned on the first floor, the first and last names must be separated
2. Change your surname first
Looking for Baijia surnames. There is no ready-made list of Baijia surnames. How to compile it? I searched and found here 128 hexadecimal weighting and coding of Baijia surnames
However, something is still wrong. It seems that I just need to throw the commonly used surnames into a list, so I process it myself
Paste the content of the surnames in the link above into the text file. Supposetest.txt, well, it probably looks like this:
Create a script to extract the last name and throw away the rest
last_names = []
with open("test.txt", "rb") as fh:
for i in fh:
last_names .append(i.strip().decode('utf-8').split(" ")[1])
print(last_names)
At this point, we have a list of hundreds of surnames
PS: Why not use u4e00-u9fa5this range? There is a high probability that you will not recognize the characters that are formed, and it hurts to look at them
chr(i) ranges from 0~255, so it’s not possible @PG
The range of
chr(i) is in 0 <= i <= 0x10ffff
>>> help(chr)
Help on built-in function chr in module builtins:
chr(...)
chr(i) -> Unicode character
Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.
I have nothing to do after get off work to join in the fun and tell me my thoughts on this problem and my code copying records
1. In order to make the generated name look like a first name, as mentioned on the first floor, the first and last names must be separated
2. Change your surname first
However, something is still wrong. It seems that I just need to throw the commonly used surnames into a list, so I process it myself

Paste the content of the surnames in the link above into the text file. Suppose
test.txt
, well, it probably looks like this:Create a script to extract the last name and throw away the rest
At this point, we have a list of hundreds of surnames
Then, randomly pick a current surname from this list of 100 surnames
Get random last name
3. Finalize the name
Run results:
严趣己
PS: Why not use
u4e00-u9fa5
this range?There is a high probability that you will not recognize the characters that are formed, and it hurts to look at them
array1=[Hundred family surnames]
array2=[GB coding interval of all Chinese characters]
concat(rand(array1),rand(array2))
The unicode code range of commonly used Chinese characters is:
u4e00-u9fa5
The range of
chr(i) is in
0 <= i <= 0x10ffff