About 167,000 results
Open links in new tab
  1. How to get the size (length) of a string in Python

    Aug 31, 2023 · "what function can i use to calculate the size of the string"? What tutorial are you using to learn Python? Please update the question with some information on where and how …

  2. python - How do I pad a string with zeros? - Stack Overflow

    How do I pad a numeric string with zeroes to the left, so that the string has a specific length?

  3. python - How to pad a string to a fixed length with spaces - Stack …

    I've been reading an official Python book for 30 minutes trying to find out how to do this. Problem: I need to put a string in a certain length "field". For example, if the name field was 15 …

  4. Python: Get size of string in bytes - Stack Overflow

    Does this answer your question? How can I determine the byte length of a utf-8 encoded string in Python?

  5. How do I make a fixed size formatted string in python?

    Closed 11 years ago. I want to create a formatted string with fixed size with fixed position between fields. An example explains better, here there are clearly 3 distinct fields and the string is a …

  6. packing and unpacking variable length array/string using the …

    A quick solution if you only need a struct extension for variable length byte sequences. Nesting a variable-length structure can be achieved by pack ing the first pack results. NetStruct supports …

  7. Python: binascii.a2b_hex gives "Odd-length string"

    6 I suspect there is a trailing newline at the end of the file. Strip the string before passing it to binascii. Note there's now also a simpler spelling: k1.strip().decode('hex').

  8. What is the max length of a Python string? - Stack Overflow

    Nov 16, 2009 · Python strings are length-prefixed, so their length is limited by the size of the integer holding their length and the amount of memory available on your system.

  9. python - Repeat string to certain length - Stack Overflow

    First off, to repeat a string an integer number of times, you can use overloaded multiplication: >>> 'abc' * 7 'abcabcabcabcabcabcabc' So, to repeat a string until it's at least as long as the length …

  10. python - How to print a string at a fixed width? - Stack Overflow

    Here's the Python Format Specification Mini-Language describing these format strings and additional options. For quick reference, the space in {0: <5} is the [fill] , the < is [align], and 5 is …