pure python question

Help
CFrank
2012-01-02
2013-01-25
  • CFrank
    CFrank
    2012-01-02

    Hi,
    hoping someone can help me. I need to have a integer converted into a bytearray.
    But the problem is, that I can only use the bytes which are really used by the integer - no padding is allowed.
    For example, if I have an integer value of 7, the bytearray should only have one item containing the value 7,
    it should NOT have 4 bytes containing the values 0,0,0,7. Same applies for an integer value of 2348. I need
    a bytearray containing bytes 09 and 2C and it should not have the leading zero bytes included.
    Is this understandable?

    Thank you
    Claudia