def splitext(p):
 i = p.rfind('.')
 if (i <= max(p.rfind('/'), p.rfind('\\'))):
  return (p, '')
 else:
  return (p[:i], p[i:])

def splitext ( p ) : i = p . rfind ( '.' ) if ( i <= max ( p . rfind ( '/' ) , p . rfind ( '\\' ) ) ) : return ( p , '' ) else : return ( p [ : i ] , p [ i : ] )
like os .