Interviews - C# Corner

Dinesh Beniwal
How can files be deleted in Python?
By Dinesh Beniwal in Python onJul 09 2019
  • Rohit Gupta
    Jul, 2019 10

    To delete a file we do:

    os.remove([file_name])

    file_name is a string hence should come in inverted commas

    • 2
  • Md Sarfaraj
    Jul, 2019 24

    Using os.remove () method you can remove file

    • 1
  • Bidyasagar Mishra
    Sep, 2019 2

    import os
    os.remove(“demofile.txt”)

    • 0
  • Arvind Singh Baghel
    Jul, 2019 18

    To delete a file first need to import: import os
    then remove function of os will remove the file
    example:
    import os
    os.remove(“filename.txt”)

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS