如何遍历来自导入的excel文档的行并获取字符串值并使用该值命名最终图像输出

我想知道如何遍历excel列,并在每一行中获取str值,并将其用于命名最终图像输出。 目前,我将最终图像命名为img1,img2,img3等,但要用行中的str值来命名。

final_qr.save(r'C:\ xxxxxxxxxxxxx \img'+ str(i) + '.png')
qzxw123 回答:如何遍历来自导入的excel文档的行并获取字符串值并使用该值命名最终图像输出

使用pylightxl非常简单,请参阅文档https://pylightxl.readthedocs.io/en/latest/quickstart.html

import pylightxl as xl

workbook = xl.readxl(‘yourexcelfile.xlsx’)

for cell in workbook.ws(‘Sheet1’).col(1):
    final_qr.save(r'C:\ xxxxxxxxxxxxx \img'+ str(cell) + '.png')
本文链接:https://www.f2er.com/2793566.html

大家都在问