def get_filename_from_cd(cd):
 if (not cd):
  return ('', '')
 fname = re.findall('filename=(.+)', cd)
 if (len(fname) == 0):
  return ('', '')
 fn = fname[0].rsplit('.', 1)
 return (fn[0], ('' if (len(fn) == 1) else ('.' + fn[1])))

def get_filename_from_cd ( cd ) : if ( not cd ) : return ( '' , '' ) fname = re . findall ( 'filename=(.+)' , cd ) if ( len ( fname ) == 0 ) : return ( '' , '' ) fn = fname [ 0 ] . rsplit ( '.' , 1 ) return ( fn [ 0 ] , ( '' if ( len ( fn ) == 1 ) else ( '.' + fn [ 1 ] ) ) )
get filename and ext from content-disposition .