954,549 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

int2byte

Hi,

is there any built in function for converting an int to a byte?

Thanks

etxulid
Newbie Poster
3 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

The integer is the smallest number in Python.
For the purpose of shift and mask operations, integers are assumed to have a binary, 2's complement notation using 32 or more bits, and hiding no bits from the user (i.e., all 4294967296 different bit patterns correspond to different values).

Ene Uran
Posting Virtuoso
1,723 posts since Aug 2005
Reputation Points: 625
Solved Threads: 213
 

it's best if you could explain what you wish to do, give sample input and output if possible

ghostdog74
Junior Poster
156 posts since Apr 2006
Reputation Points: 75
Solved Threads: 44
 

The size of a character in a string is a byte. You could use ord() and chr() to convert back and forth. Make your life interesting!

Ene Uran
Posting Virtuoso
1,723 posts since Aug 2005
Reputation Points: 625
Solved Threads: 213
 

You might want to study the Python module binascii.

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You