8 您可以 import os >>> filepath '/a/path/to/my/file.txt' >>> os.path.dirname(filepath) '/a/path/to/my' >>> — 奥尤比 source
2 (dirname, filename) = os.path.split(path) — 伊戈尔·楚宾(Igor Chubin) source 更准确地说:(rest, first_path_item) = os.path.split(path) — estani 2012年
(rest, first_path_item) = os.path.split(path)