superpollo <u...@example.net> writes: > >>> number = 252509952 > >>> hex(number) > '0xf0cff00' > >>> > > so i would like a string like '\xf0\xcf\xf0\x00'
def encode(number): h = '%x' % number if len(h) % 2 == 1: h = '0' + h return h.decode('hex') -- http://mail.python.org/mailman/listinfo/python-list