Fonction de découpage des chemins des fichiers

Author:


{filelink=16416}

 
import os, time
 
path= 'c:/test.txt'
 
print os.path.basename(path)       #test.txt
 
print os.path.dirname(path)        # C:
 
print os.path.split(path)          #('c:/', 'test.txt')
 
print os.path.splitdrive(path)     # ('c:', '/test.txt')
 
# Extension
print os.path.splitext(path)       # ('c:/test', '.txt')
 
print os.path.abspath(path)        # c:test.txt

Livres Sur ce Sujet

Apprendre à programmer avec Python 3 Apprenez à programmer en Python Python : Petit guide à l’usage du développeur agile Apprendre à programmer avec Python 3 : Avec plus de 50 pages de corigés d’exercices !

Leave a Reply

Your email address will not be published. Required fields are marked *


two + 4 =