File isn't deleted after move
I want to change directory for just created file and delete it from old directory. File is moved, but in old directory file isn't deleted as I expect, why? I tryed to change my code, so when file is created in advace it's deleted with no problem.
import shutil src = 'D:\w\Pack.txt' dst = 'D:\w\StrangeFolder\Pack.txt' filename = "Pack.txt" with open(filename, 'w') as f: shutil.move(src, dst) shutil.rmtree(filename)