Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78103 > unrolled thread
| Started by | Peter Otten <__peter__@web.de> |
|---|---|
| First post | 2014-09-20 14:27 +0200 |
| Last post | 2014-09-20 14:27 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: pad binary string with a given byte value (python 3) Peter Otten <__peter__@web.de> - 2014-09-20 14:27 +0200
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2014-09-20 14:27 +0200 |
| Subject | Re: pad binary string with a given byte value (python 3) |
| Message-ID | <mailman.14166.1411216064.18130.python-list@python.org> |
Nagy László Zsolt wrote: > I can figure out way for example this: > > >>> b'T'+bytearray([32]) > > but it just don't seem right to create a list, then convert it to a byte > array and then convert it to a binary string. What am I missing? By the way, you can repeat bytes (and strings) by multiplying: >>> b"\x01"*3 b'\x01\x01\x01' >>> b"ab"*3 b'ababab'
Back to top | Article view | comp.lang.python
csiph-web