address_list=address.split('\n')#address_dic={'姓名':'','手机号':'','小号':'','内线':'','座机':'','邮箱':''}
ls=['name','mob','short','tel','tel1','email']
address_dic={}#包含字典的dictfor i inrange(len(address_list)):
temp=address_list[i].split(',')#print(dict(zip(ls,temp)))
temp_dic=dict(zip(ls,temp))
address_dic.update({temp_dic['name']:{'name':temp_dic['name'],'mob':temp_dic['mob'],'short':temp_dic['short'],'tel':temp_dic['tel'],'tel1':temp_dic['tel1'],'email':temp_dic['email']}})defmathcing(match):#模糊匹配,匹配模式:徐* ,返回匹配到的姓名列表
ls_temp=[]for i in address_dic.keys():if match[0]in i and match[1:]=='*':#print('徐在姓氏表里!')
ls_temp.append(i)#print(ls_temp)return(ls_temp)
if msg_content in address_dic.keys():#发送文字信息
itchat.send_msg(address_dic[msg_content]['name']+'的通讯录::'+'\n'+'手机号码:'+address_dic[msg_content]['mob']+'\n手机小号:'+address_dic[msg_content]['short']+'\n座机内线:'+address_dic[msg_content]['tel']+'\n座机外线:'+address_dic[msg_content]['tel1']+'\nEmail:'+address_dic[msg_content]['email'], msg['FromUserName'])