人名批量转拼音 VX 15895888734
作者:互联网
from openpyxl import load_workbook
from xpinyin import Pinyin
# 默认可读写,若有需要可以指定write_only和read_only为True
wb = load_workbook('1.xlsx')
# a_sheet = wb.get_sheet_by_name('Sheet1')
sheet = wb.active
a=""
for row in sheet.rows:
for cell in row:
if cell.value is None:
p = Pinyin()
d=p.get_pinyin(cell.value, '')#全拼
else:
p = Pinyin()
d=p.get_pinyin(cell.value, '')#全拼
a+=cell.value+","+str(d)+"\n"
print(a)
标签:sheet,15895888734,全拼,get,Pinyin,value,cell,VX,拼音 来源: https://www.cnblogs.com/huchaoheng/p/15799345.html