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 = 0L
for i in s:
l <<= 8
l |= ord(i)
return l
评论列表
文章目录