Articles → PYTHON → Rename And Delete A File In Python

Rename And Delete A File In Python






Code Of Renaming The File




import os

os.rename("c:/temp/copy.py","c:/temp/mycopy.py")



Output


Picture showing the file named using python



Delete The File




import os
os.remove("c:/temp/mycopy.py")



Posted By  -  Karan Gupta
 
Posted On  -  Friday, September 10, 2021

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250