how to convert ‘\xf0' to 0xf0 ?

2008-12-11 Thread chengang . beijing
int('\xf0',16) doesn't work, any way to do that? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to convert ‘\xf0' to 0xf0 ?

2008-12-11 Thread chengang . beijing
'\xf0' is the value read from a binary file, I need to change this kinds strings to int for further processing... if it is in C, then '\xf0' is an integer and it can be handled directly, but in python, it is a string. and both int('10',16) and int('0x10',16) returns 16. Br, Chen Gang On Dec 12,

Re: how to convert '\xf0' to 0xf0 ?

2008-12-11 Thread chengang . beijing
Hi, ord('\xf0') works and it only works for char. Do you know any way to convet '\xf0\xf0' and '\xf0\xf0\xff\xfe' to integer? Br, Chen Gang On Dec 12, 12:40 pm, Steve Holden wrote: > chengang.beij...@gmail.com wrote: > > '\xf0' is the value read from a binary file, I need to change this > > ki