os.remove(cPath+'\\'+'t')
os.remove(cPath+'\\'+cName)
os.rename(cPath+'\\ok',cPath+'\\'+cName)
r = 0
while r < 40:
if r < 10:
rr = '0'+str(r)
else:
rr = str(r)
if os.path.exists(cPath+'\\T'+rr) == True:
os.remove(cPath+'\\T'+rr)
r = r + 1
------解决方案-------------------- 不会是目录吧,参考这样操作:
import os
for root, dirs, files in os.walk(top, topdown=False):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
os.rmdir(os.path.join(root, name))
还有可能是这个文件被打开了。。 ------解决方案-------------------- 写path,尤其是windows,我一般都谨慎用 r'' 格式
或者 os.sep
或者直接写 'c:/xxx/xxx',python是能识别的 ------解决方案-------------------- 查了一下
WindowsError: [Error 32] The process cannot access the file beacause it is being used by another process.
这就比较明显了 ------解决方案--------------------
查了一下
WindowsError: [Error 32] The process cannot access the file beacause it is being used by another process.
这就比较明显了