没有 Excel 编写器‘xlwt’

问题描述 投票:0回答:0

xlwt 已安装,在 python 3.9 上

    current_dir = os.path.dirname(__file__)
    pathXLSX = os.path.join(current_dir,'moveData',weapon[0]+".xlsx")
    pathXLS = os.path.join(current_dir,'moveData',weapon[0]+".xls")
    df.to_excel((os.path.abspath(pathXLSX)+"").replace('/','\\'),index=False)
    xlsx_to_xls(pathXLSX,pathXLS)
def xlsx_to_xls(xlsx_filename, xls_filename):

    df = pd.read_excel(xlsx_filename, engine='openpyxl')

    df.to_excel(xls_filename, index=False, engine='xlwt')

xlwt 已安装,在 python 3.9 上

def xlsx_to_xls(xlsx_filename, xls_filename):

    df = pd.read_excel(xlsx_filename, engine='openpyxl')

    df.to_excel(xls_filename, index=False, engine='xlwt')
python pandas xlsx xls xlwt
© www.soinside.com 2019 - 2024. All rights reserved.