¡@

Home 

python Programming Glossary: xcc

Python returning the wrong length of string when using special characters

http://stackoverflow.com/questions/2247205/python-returning-the-wrong-length-of-string-when-using-special-characters

str literal written in an encoded notation len ' xc3 xab xcc x81a xc3 xbalt' 9 # you can convert any str to an unicode object.. any str to an unicode object by decoding it len ' xc3 xab xcc x81a xc3 xbalt'.decode 'utf 8' 6 Of course you can also access..

convert a string of bytes into an int (python)

http://stackoverflow.com/questions/444591/convert-a-string-of-bytes-into-an-int-python

a string of bytes into an int in python Say like this 'y xcc xa6 xbb' I came up with a clever stupid way of doing it sum.. way of doing it sum ord c i 8 for i c in enumerate 'y xcc xa6 xbb' 1 I know there has to be something builtin or in the.. faster from timeit import Timer Timer 'struct.unpack L y xcc xa6 xbb 0 ' 'import struct' .timeit 0.36242198944091797 Timer..