爲什麼我收到蟒蛇os.remove不能訪問該文件
Traceback (most recent call last): File "C:\temp\py\tesst.py", line 8, in <module>
os.remove(PATH) PermissionError: [WinError 32] The process cannot access the file because it is being used by another process:
'C:\temp\py\test.txt'
import os
PATH = r'C:\temp\py\test.txt'
f = open ( PATH,'w')
f.write('test\n')
f.close;
os.remove(PATH)
我缺少的東西?
'f.close'應該是'f.close()' –
謝謝!我想我正在讀一個變量.. – user929542
你引用的方法,而不是調用它 –