路径比方说,我有看起来像这样的目录路径:关于产品在Python
this/is/the/basedir/path/a/include
this/is/the/basedir/path/b/include
this/is/the/basedir/path/a
this/is/the/basedir/path/b
在Python,我怎么能起来拆分这些路径,使他们看起来是这样,而不是:
a/include
b/include
a
b
如果我运行os.path.split这样的(路径)[1]它会显示:
include
include
a
b
我应该怎么在这里尝试了,我应该寻找在索姆e正则表达式命令还是可以在没有它的情况下完成?提前致谢。
编辑所有:我解决它使用正则表达式,真他妈方便的工具:)
目前还不清楚你如何确定在哪里拆分路径。例如,你想用一些/ other/basedir /和/ stuff/that/I/include来做什么? – 2009-07-14 13:34:18