【发布时间】:2020-04-06 14:09:50
【问题描述】:
我想读取一个 excel 文件并在其写入工作表后创建文件夹。 我想获取前 2 列,合并它们,然后创建以它们命名的文件夹。好吧,我是新来的,试着在论坛里找遍了......
这是我的代码:
arquivo = xlrd.open_workbook('C:\\Users\\xxx\\Desktop\\Engetran\\Ceriluz\\01-Projeto Executivo\\00 - Documentos\\EGTR-M-P03 - Documentos.xls')
linha = arquivo.sheet_by_index(0)
lista_valores1 = linha.col_values(0)
lista_valores2 = linha.col_values(1)
lista_valores = f"{lista_valores1} {lista_valores2}c"
os.mkdir('C:\\Users\\xxx\\Desktop\\Nova pasta (5)\\Projeto Executivo')
root_path = 'C:\\Users\\xxx\\Desktop\\Nova pasta (5)\\Projeto Executivo'
folders = [ lista_valores ]
for folder in folders:`
os.mkdir(os.path.join(root_path,folder))`
我得到一个错误:
filenotfounderror winerror 3 the system cannot find the path specified
如果您有任何回应,我将不胜感激!
【问题讨论】:
标签: python excel merge directory path