
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to delete a file using Python?
You can delete a single file or a single empty folder with functions in the os module. For example, if you want to delete a file my_file.txt,
>>> import os >>> os.remove('my_file.txt')
The argument to os.remove must be absolute or relative path.
- Related Questions & Answers
- How to delete all the file contents using PowerShell?
- How to delete a temporary file in Java?
- C program to delete a file
- How to rename a file using Python?
- How to find a file using Python?
- How to remove a file using Python?
- Delete a file in C#
- How to delete a character from a string using python?
- How to create a tar file using Python?
- How to create a zip file using Python?
- How to delete a string inside a file(.txt) in java?
- How to create a duplicate file of an existing file using Python?
- How to delete the specific node from the XML file using PowerShell?
- How to delete the azure blob (File) using Azure CLI in PowerShell?
- How to delete azure blob (file) from the Storage account using PowerShell?
Advertisements