SORU
12 ŞUBAT 2009, PERŞEMBE


Python ile dosya ayıklama uzantısı

Bir işlevi, bir dosya adı uzantısı ayıklamak için var mı?

CEVAP
12 ŞUBAT 2009, PERŞEMBE


Evet. Kullanım os.path.splitext:

>>> import os
>>> filename, file_extension = os.path.splitext('/path/to/somefile.ext')
>>> filename
'/path/to/somefile'
>>> file_extension
'.ext'

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

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • macpulenta

    macpulenta

    9 EYLÜL 2006
  • MyTiredBones

    MyTiredBones

    2 Temmuz 2013
  • Phymec

    Phymec

    18 Temmuz 2009