bytes/str.ljust()

def pad(b, n=16, c=b"\x0f"):
...     length = (len(b)+n-1)//n*n
...     return b.ljust(length, c)
Thanks!
One more question. How do I create a single char binary string from a number? E.g.

>>> bytes([65])
b'A'

It seems to be wrong again. The bytes constructor requires a sequence, and I don't like creating a list or a tuple just to convert it into a binary string.

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to