“So löschen Sie eine Datei in Python” Code-Antworten

Python löschen Datei

import os
import shutil

if os.path.exists("demofile.txt"):
  os.remove("demofile.txt") # one file at a time

os.rmdir("test_directory") # removes empty directory
shutil.rmtree("test_directory") # removes not empty directory and its content
Charming Crab

Python OS Entfernen Sie die Datei

import os
os.remove("filename.txt")
Duco Defiant Dogfish

So löschen Sie eine Datei in Python

import os
os.remove("ChangedFile.csv")
print("File Removed!")
Handsome Hawk

Löschen einer Datei mit Python

import os

# os.remove("text.txt")
# print("File deleted")


for file in os.listdir("fileDirectory"):
    os.remove("fileDirectory"+file)
    print(file, "deleted")
Weary Wolverine

Python löschen Datei

import os
os.remove("/tmp/<file_name>.txt")
Intempestive Al Dente

Ähnliche Antworten wie “So löschen Sie eine Datei in Python”

Fragen ähnlich wie “So löschen Sie eine Datei in Python”

Weitere verwandte Antworten zu “So löschen Sie eine Datei in Python” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen