def natsortKey(string_):
 return [(int(s) if s.isdigit() else s) for s in re.split('(\\d+)', string_)]

def natsortKey ( string_ ) : return [ ( int ( s ) if s . isdigit ( ) else s ) for s in re . split ( '(\\d+)' , string_ ) ]
see URL .