def str2long(s):
    """Convert a string to a long integer."""
    if type(s) not in (types.StringType, types.UnicodeType):
        raise ValueError('the input must be a string')

    l = 0
    for i in s:
        l <<= 8
        l |= ord(i)

    return l
def str2long ( s ) : if type ( s ) not in ( types . StringType , types . UnicodeType ) : raise ValueError ( 'the input must be a string' ) l = 0 for i in s : l <<= 8 l |= ord ( i ) return l
Convert a string to a long integer.