Any Direction File Remove and Delete.py

import os

os.chdir("C:/Users/Ar Anik/Desktop")

#file open
with open("input.txt", "w") as f :
f.write("Hi... I am Anik.")

# rename("", "") --> ("Old file name", "New file name")
os.rename("input.txt", "anik.txt")

# remove("") --> ("location/file name")
os.remove("C:/Users/Ar Anik/Desktop/anik.txt")

Comments