In <592233bd-3fc1-4e13-97f8-e11f89fbb...@googlegroups.com> Ferrous Cranus <nikos.gr...@gmail.com> writes:
> > pin int( htmlpage.encode("hex"), 16 ) % 10000 > > > > It'll give you your number, but there are no guarantees of uniqueness. > You're looking at more blind random luck using that. > Finally!!!!!! THANK YOU VERY MUCH!!! THIS IS WHAT I WAS LOOKING FOR!!! No it isn't; you said you wanted a unique 4-digit number. This method can return the same 4-digit number for lots of different file paths. > NOW, if you please explain it to me from the innermost parenthesis please, > because i do want to understand it!!! 1. Transform the html path string into a (large) hexadecimal number using the encode() function. 2. Convert the hexadecimal number into a decimal integer using the int() function. 3. Shrink the integer into the range 0-9999 by using the % operator. -- http://mail.python.org/mailman/listinfo/python-list