Wenn du dir nicht sicher bist, in welchem der anderen Foren du die Frage stellen sollst, dann bist du hier im Forum für allgemeine Fragen sicher richtig.
import os
def PfadLoeschen():
for g in os.walk("C:Neuer Ordner"):
import os.path
anfang="C:Neuer Ordner"
Ende=g
alles(anfang+Ende)
if os.path.isfile(alles):
os.remove(alles)
removedirs("C:Neuer Ordner")
Könntet ihr mir ne kleine Hilfe Geben???
Falls ja, danke
[b][i]ein kleines game für die die lust haben http://konaminut.mybrute.com[/i][/b]
;-)
os.remove(path)¶
Remove the file path. If path is a directory, OSError is raised; see rmdir() below to remove a directory. This is identical to the unlink() function documented below. On Windows, attempting to remove a file that is in use causes an exception to be raised; on Unix, the directory entry is removed but the storage allocated to the file is not made available until the original file is no longer in use. Availability: Unix, Windows.
os.removedirs(path)¶
Remove directories recursively. Works like rmdir() except that, if the leaf directory is successfully removed, removedirs() tries to successively remove every parent directory mentioned in path until an error is raised (which is ignored, because it generally means that a parent directory is not empty). For example, os.removedirs('foo/bar/baz') will first remove the directory 'foo/bar/baz', and then remove 'foo/bar' and 'foo' if they are empty. Raises OSError if the leaf directory could not be successfully removed.
New in version 1.5.2.
Wenn die Ordner nicht leer sind, musst du die natürlich leeren.
Zuletzt geändert von cofi am Freitag 2. Januar 2009, 18:19, insgesamt 1-mal geändert.