【发布时间】:2010-09-24 08:38:01
【问题描述】:
想象一下我有以下几点:
inFile = "/adda/adas/sdas/hello.txt"
# that instruction give me hello.txt
Name = inFile.name.split("/") [-1]
# that one give me the name I want - just hello
Name1 = Name.split(".") [0]
有没有机会用一个表达式来简化做同样的工作?
【问题讨论】:
标签: python