split twice in the same expression?
Imagine I have the following:
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(".") 
Is there any chance to simplify that doing the same job in just one expression?
You can get what you want platform independently by using
from os.path import basename, splitext pathname = "/adda/adas/sdas/hello.txt" name, extension = splitext(basename(pathname)) print name # --> "hello"
It also carries most points because it answers your question for "one line" precisely and is aesthetically more pleasing then your example (even though that is debatable as are all questions of taste)