Questa funzioncina, che fa da pendant con questa, serve invece per estrarre solo il nome del file, senza estensione.
def get_filename(f):
"""return the filename from f=str(filename.extension)"""
from string import count,split,join
if f.count(".")<=0:
return f
a=split(f,".")
if f.count(".")==1:
return a[0]
else:
return join(a[:-1],".")

Follow
