目录中有几个xlsx
文件。但我想搜索xlsx
文件与文件名20230406115500.001.A0.XZI.INVOICING_ES101_Anlage_DISCO_Split_20230405_114751.xlsx
。
我想搜索上面的文件与模式匹配的东西像*ES101*.xlsx
,然后将此xlsx
文件转换为csv
。只有一个文件具有此文件名模式。下面是Python代码:
import pandas as pd
read_file = pd.read_excel (r'/home/repo/"*ES101*.xlsx"')')
read_file.to_csv (r'/home/repo/ES101.csv', index = None, header=True)
但它会抛出错误No such file or directory
。我在Linux服务器上运行这个Python代码。我用的是Python3.9
版本。
1条答案
按热度按时间piztneat1#
你可以使用glob函数搜索,然后读取文件:
您需要安装xlsxwriter引擎。