如直接写
f=open('Users/librom/Documents/Python/临时文件/模拟卷/天龙八部.py ','r')
就会报错
Traceback (most recent call last):
File "", line 1, in
f=open('Users/librom/Documents/Python/临时文件/模拟卷/天龙八部.py ','r')
FileNotFoundError: [Errno 2] No such file or directory: 'Users/librom/Documents/Python/临时文件/模拟卷/天龙八部.py '
2个解决方法
import os
os.chdir(r'/Users/librom/Documents/临时文件/模拟卷')
详见:https://blog.csdn.net/weixin_42884201/article/details/81515683
当前python版本3.7.4