FileNotFoundError
df1=pd.read_excel('ab.xlsx')
print(df1)
File "C:\Users\123\PycharmProjects\pythonProject\venv\lib\site-packages\pandas\io\common.py", line 798, in get_handle
handle = open(handle, ioargs.mode)
FileNotFoundError: [Errno 2] No such file or directory: 'ab.xlsx'
Process finished with exit code 1
我的'ab.xlsx'文件放在桌面,和py文件放在一起
我想读取我的'ab.xlsx'文件
1、建议用绝对路径
2、程序加2句,看当前目录是什么
import os
print(os.getcwd())
你执行这个
print(os.getcwd())
看看当前路径到底是什么