2012-08-01 9 views

答えて

46

使用os.path.dirname(filename)なし.split(としようとしました>/a/path/to/my/

)。 os.path

os.path.dirname('/test/one') 
1

チェック潜水艦することはできimport os

>>> filepath 
'/a/path/to/my/file.txt' 
>>> os.path.dirname(filepath) 
'/a/path/to/my' 
>>> 
2
(dirname, filename) = os.path.split(path) 
+0

より正確には: '(残り、first_path_item)= os.path.split(パス)' – estani

関連する問題