Hi,

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

Thanks

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).

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

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!

You might want to study the Python module binascii.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.