name="01_Blue_Sun_DSC08897.jpg" print name[3:-13].replace('_',' ') #Blue Sun# len(str) # string length "hello world".title() 'Hello World' # remove Whitespace on the both sides: s = " \t a string example\t " s = s.strip() # remove Whitespace on the right side: s = s.rstrip() # remove Whitespace on the left side: s = s.lstrip()