代码
import random
surname='赵钱孙李周吴郑王冯陈褚卫蒋沈韩杨朱秦尤许'
second='中万斯近元伟丽利国士文连百宏可立成海友南广云基'
third='隆智渝顺乐天杰夫煜兵思霆炜祺亮剀炫翔维瑞韬嘉林庆玮勤栋源路焕霖彩明邦闻朵皓瀚荣奕涓艺'
surname_new=surname.split(',')
second_new=second.split(',')
third_new=third.split(',')
namelist=[]
many = input('请输入需要生成姓名的数量:\n')
for i in range(int(many)):
data=[2,3]
namelen=random.choice(data)
if namelen==2:
newname=random.choice(surname)+random.choice(second)
else:
newname =random.choice(surname)+random.choice(second)+ random.choice(third)
namelist.append(newname)
print('生成的虚拟姓名列表为:\n' + '\n'.join(namelist))
效果