Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

23 строки
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_