0
所以我的代碼基本上是設計刪除一個文件,如果不正確的數據輸入。然而,它不起作用,驚喜。Win32錯誤,無法刪除文件沒有錯誤
這裏是我的刪除部分代碼:
except ValueError:
print("Something went wrong")
file = open(username + ".txt", "w")
file.close()
import os, sys
os.remove(username + ".txt")
break
,這是我保留錯誤:
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'newtext.txt'
任何幫助將是巨大的感謝:d
您是否使用其他地方的文件?忘了關閉它在你的代碼或其他程序的不同部分? – mirosval