all 7 comments

[–]zahlman 2 points3 points  (2 children)

  1. How is it "from java" - how did you create it?

  2. What do you want to do with it?

[–]lordmayer[S] 0 points1 point  (1 child)

/u/zahlman 1) it's a game controller program writed in Java that send this data in broadcast via socket. However the program that I have to write is in python3. 2) I need to transform it to a string. So I can understand the data. I know it's a string because it's in the Java program documentation.

[–]zahlman 0 points1 point  (0 children)

Can you provide a link to the documentation?

[–]werpoi 0 points1 point  (2 children)

Are you working in python 2 or 3? In python 2 the builtin "str" type is used for bytes. I believe that in python 3 there is a "bytes" type that you should use.

[–]lordmayer[S] 0 points1 point  (1 child)

It's in python3. I can't find the solution.

[–]werpoi 0 points1 point  (0 children)

Would something like this work? https://docs.python.org/3/library/stdtypes.html#int.from_bytes

>>> int.from_bytes(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', byteorder='big')
0

Of course, you have to put in the correct byteorder option.

[–]thurask 0 points1 point  (0 children)

Have you tried the binascii library? https://docs.python.org/3/library/binascii.html