生成电话号码
def phone_num(self):
num_start = ['134', '135', '136', '137', '138', '139', '150', '151', '152', '158', '159', '157', '182', '187', '188',
'147', '130', '131', '132', '155', '156', '185', '186', '133', '153', '180', '189']
start = random.choice(num_start)
end = ''.join(random.sample(string.digits,8))
res = start + end
return res
生成姓名
#人名(name_len:两字人名三字人名)(name_type=1人名,name_type=0其他非人名)
def peopleName_str(self,name_len,name_type):
if name_len < 2:
name_len = 2
elif name_len > 3:
name_len = 3
str1="赵钱孙李周吴郑王冯陈褚蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶" \
"姜戚谢邹喻柏水窦章云苏潘葛奚范彭郎鲁韦昌马苗凤花方俞任袁柳酆鲍" \
"史唐费廉岑薛雷贺倪汤滕殷罗毕郝邬安常乐于时傅皮卞齐康伍余元卜顾" \
"孟平黄和穆萧尹姚邵湛汪祁毛禹狄米贝明臧计伏成戴谈宋茅庞熊纪舒屈" \
"项祝董梁杜阮蓝闵席季麻强贾路娄危江童颜郭梅盛林刁钟徐邱骆高夏蔡" \
"田樊胡凌霍虞万支柯昝管卢莫经房裘缪干解应宗丁宣贲邓单杭洪包诸左石" \
"崔吉钮龚程嵇邢滑裴陆荣翁荀羊於惠甄麹家封芮羿储靳汲邴糜松井段富巫乌" \
"焦巴弓牧隗山谷车侯宓蓬全郗班仰秋仲伊宫"
if name_type == 0:
str0 = chr(random.randint(0x4e00, 0x9fbf))
else:
str0 = str1
if name_len == 2:
Family_name = random.choice(str0)
first_name = chr(random.randint(0x4e00, 0x9fbf))
name = Family_name + first_name
else:
Family_name = random.choice(str0)
first_name = chr(random.randint(0x4e00, 0x9fbf))
middle_name = chr(random.randint(0x4e00, 0x9fbf))
name = Family_name + first_name + middle_name
return name