#NEWLINE# def splitext( p ) : #NEWLINE# #INDENT# 'Split the extension from a pathname.  Extension is everything from the\n    last dot to the end.  Returns "(root, ext)", either part may be empty.' #NEWLINE# i = p . rfind ( '.' ) #NEWLINE# if ( i <= p . rfind ( '/' ) ) : #NEWLINE# #INDENT# return ( p , '' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( p [ : p ] , p [ i : ] )