用python写一段excel整理的代码
时间: 2023-03-14 17:02:55 浏览: 93
数据挖掘和整理成excel相关的python程序
5星 · 资源好评率100%
可以参考下面这段代码:import openpyxl
wb = openpyxl.load_workbook('example.xlsx')
sheet = wb['Sheet1']
for row in range(2, sheet.max_row + 1):
cell_name = sheet.cell(row, 1)
cell_price = sheet.cell(row, 2)
print(cell_name.value + "的价格是:" + str(cell_price.value))
wb.save('example.xlsx')
阅读全文