SORU
19 Ocak 2012, PERŞEMBE


Nasıl dizin Python içinde olup olmadığını bulmak için

Python os Bu modül, bir yolu var, eğer bir dizin olup olmadığını bulmak için, bir şey gibi

>>> os.direxists(os.path.join(os.getcwd()), 'new_folder')) # in pseudocode
True/False

CEVAP
19 Ocak 2012, PERŞEMBE


Eğer bir dosya veya dizin olup olmadığı umurunda bile os.path.isdir os.path.exists arıyoruz.

Örnek:

import os
print(os.path.isdir("/home/el"))
print(os.path.exists("/home/el/myfile.txt"))

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Damien Hayes

    Damien Hayes

    11 Mart 2008
  • Jucyber Tutoriais

    Jucyber Tuto

    8 EYLÜL 2009
  • Madeon

    Madeon

    31 Ocak 2010