Splitting Pathnames : Path : File PYTHON TUTORIALS


PYTHON TUTORIALS » File » Path »

 

Splitting Pathnames


import os 
print os.path.split("c:\a\b\c.mp3")                  
(filepath, filename= os.path.split("c:\a\b\c.mp3")
print filepath                                                          
print filename                                                            
(shortname, extension= os.path.splitext(filename)                   
print shortname 
print extension



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo File
» Path