【问题标题】:No such directory/files after joining 2 folderpath加入2个文件夹路径后没有这样的目录/文件
【发布时间】:2022-09-30 18:31:54
【问题描述】:

fph= pathlib.Path(r\'C:\\Users\\anon\\desk\\inside\') #filedirectory

fp1 = fph.joinpath(fph, \'\\inside\\maps.xlsx\')

Nmap= pd.read_excel(fp1, sheet_name=\'Swis\')

我想加入 2 个文件夹路径并能够读取 maps.xlsx,但是当运行代码时它说 \'There are no directory or files \'\\inside\\maps.xlsx

  • 我想你想做fph.joinpath(\'inside\", \"maps.xlsx\')

标签: python pandas


【解决方案1】:

它正在尝试读取:r'C:\Users\anon\desk\inside\inside\maps.xlsx'。我想你想要:r'C:\Users\anon\desk\inside\maps.xlsx' 所以你需要:

fp1 = fph.joinpath(fph, '\maps.xlsx')

【讨论】:

    猜你喜欢
    • 2019-08-24
    • 2022-01-15
    • 2022-01-06
    • 1970-01-01
    • 1970-01-01
    • 2020-05-31
    • 1970-01-01
    • 1970-01-01
    • 2017-11-20
    相关资源
    最近更新 更多