Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 

23 řádky
494 B

  1. # coding: utf-8
  2. from __future__ import unicode_literals, division, absolute_import, print_function
  3. def fill_width(bytes_, width):
  4. """
  5. Ensure a byte string representing a positive integer is a specific width
  6. (in bytes)
  7. :param bytes_:
  8. The integer byte string
  9. :param width:
  10. The desired width as an integer
  11. :return:
  12. A byte string of the width specified
  13. """
  14. while len(bytes_) < width:
  15. bytes_ = b'\x00' + bytes_
  16. return bytes_