"Tuvas" <[EMAIL PROTECTED]> writes: > def s2num(text): > if(len(text)==1): > return ord(text) > else: > return ord(text[0])+256*s2num(text[1:])
My favorite way to convert strings to numbers is with binascii: from binascii import hexlify def s2num(text): return int(hexlify(text), 16) > def cran_rand(min,max): > range=int(log(abs(max-min))/log(2))+1 This is kind of ugly and I wonder if it's possible for roundoff error in the log function to make the answer off by 1, if max-min is very close to a power of 2. -- http://mail.python.org/mailman/listinfo/python-list