python进制转换库_Python中的十六进制转换

Hello, I am reading in a socket message from a server and am only

receiving this ''....''. Now obviously it is in the wrong format. How

would I convert these bys in Python, I have looked everywhere but I do

not see much documentation on converting ptyhon types to other data

types.

Any Help would be appreciated.

解决方案DaBeef wrote:

Hello, I am reading in a socket message from a server and am only

receiving this ''....''. Now obviously it is in the wrong format. How

would I convert these bys in Python, I have looked everywhere but I do

not see much documentation on converting ptyhon types to other data

types.

What is the server supposed to send (you need to know that

if you want to decode it).

Then, lookup struct.unpack .

HTH

Stefan

it is returning data such as 0x04. I am new to python so this is a

pain for me, learning to do this in a language whose llibrary is

somewhat limited. But instead I receieve .... So I wnat to convert to

the original data. Also can you define a constant in Python such as

#define value 0x04

Thank-you for your help

DaBeef wrote:

it is returning data such as 0x04.

But you need to know what kind of data the other side is sending,

i.e. what kind of protocol it speaks.

I am new to python

New and starting with socket/network programming ?

Brave!

so this is a

pain for me, learning to do this in a language whose llibrary is

somewhat limited.

You mean Pythons'' library is limited?

You know nothing...

But instead I receieve .... So I wnat to convert to

the original data. Also can you define a constant in Python such as

#define value 0x04

You should look here:

http://docs.python.org/

And probably here, too:

http://diveintopython.org/toc/index.html

What does your ''socket receiver'' look like ?

Stefan

--

Stefan N?¤we

stefan_AT_naewe_DOT_de

你可能感兴趣的:(python进制转换库)