(ver)
return int(values[0]) * 1000000 + int(values[1]) * 1000 + int(values[2])
A key function that takes a version and returns a numeric value that can
    be used for sorting

    >>> version_key('2')
    2000000
    >>> version_key('2.9')
    2009000
    >>> version_key('2.10')
    2010000
    >>> version_key('2.9.1')
    2009001
    >>> version_key('2.9.1.1')
    2009001
    >>> version_key('2.9B')
    Traceback (most recent call last):
      ...
    ValueError: invalid literal for int() with base 10: '9B'
A key function that takes a version and returns a numeric value that can
    be used for sorting
A key function that takes a version and returns a numeric value that can be used for sorting
def version_key(ver):
    """
    A key function that takes a version and returns a numeric value that can
    be used for sorting

    >>> version_key('2')
    2000000
    >>> version_key('2.9')
    2009000
    >>> version_key('2.10')
    2010000
    >>> version_key('2.9.1')
    2009001
    >>> version_key('2.9.1.1')
    2009001
    >>> version_key('2.9B')
    Traceback (most recent call last):
      ...
    ValueError: invalid literal for int() with base 10: '9B'

    """
    padded = ver + '.0.0'
    values = padded.split('.')
    return int(values[0]) * 1000000 + int(values[1]) * 1000 + int(values[2])
def version_key ( ver ) : padded = ver + '.0.0' values = padded . split ( '.' ) return int ( values [ 0 ] ) * 1000000 + int ( values [ 1 ] ) * 1000 + int ( values [ 2 ] )