os.listdir(path)

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.
Antworten
huppi

Ich lese mit os.listdir(path) den Inhalt von path unter unix ein. Wie kann ich jetzt wissen ob es sich bei einem Element in der Liste um ein Verzeichnis oder eine Datei handelt?

gruß huppi
RicmanX
User
Beiträge: 69
Registriert: Donnerstag 29. August 2002, 17:10
Wohnort: Erfurt
Kontaktdaten:

os.path.

isfile(path)
Return true if path is an existing regular file. This follows symbolic links, so both islink() and isfile() can be true for the same path.

isdir(path)
Return true if path is an existing directory. This follows symbolic links, so both islink() and isdir() can be true for the same path.

islink(path)
Return true if path refers to a directory entry that is a symbolic link. Always false if symbolic links are not supported.

:)
Antworten