import xlrd
import re
def qu():
wb = xlrd.open_workbook('xxxxxxxx.xlsx')
sh = wb.sheet_by_name('9.10')
for i in range(sh.nrows)[1:200]:
i_li = sh.row_values(i)
print(i_li)
if i_li[-1]:
number_list = re.findall('d+',str(i_li[-1]))
print(number_list)
for number in number_list:
if number !='0':
with open("通讯.vcf", "a", encoding='utf-8')as f:
f.write('BEGIN:VCARD')
f.write('
')
f.write('VERSION:3.0')
# f.write('
')
#
# f.write('N;CHARSET=utf-8:;{};;;'.format(i_li[0]))
f.write('
')
# f.write('FN;CHARSET=utf-8: {}'.format(i_li[0]))
f.write('FN:{}'.format(i_li[0]))
f.write('
')
f.write('TEL;type=CELL;type=VOICE;type=pref:{}'.format(int(float(number))))
# f.write('TEL;CELL:{}'.format(int(float(bunber))))
f.write('
')
f.write('END:VCARD')
f.write('
')
qu()