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

    "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 you're learning Python.

  2. How to calculate the length of the string in python

    Aug 22, 2017 · How to calculate the length of the string in python Asked 8 years, 3 months ago Modified 5 years, 4 months ago Viewed 29k times

  3. python - Manually compute the length of a string - Stack Overflow

    Jun 17, 2017 · A string has an attribute __len__, a function that returns the length of the string. Thus, the following solution does not use built-ins, but the calculation is trivial (without calculating operations, …

  4. 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?

  5. 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?

  6. python - How to sort a list by length of string followed by reverse ...

    the_list.sort(key=len, reverse=True) # sorts by descending length Python's sort is stable, which means that sorting the list by length leaves the elements in alphabetical order when the length is equal.

  7. 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 characters long, and …

  8. Why does Python code use len () function instead of a length method ...

    Oct 26, 2008 · I know that Python has a len() function that is used to determine the size of a string, but why is it not a method of the string object?

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

    12 This will help to keep a fixed length when you want to print several elements at one print statement. 25s formats a string with 25 spaces, left justified by default. 5d formats an integer reserving 5 …

  10. What's the best way to split a string into fixed length chunks and work ...

    What's the best way to split a string into fixed length chunks and work with them in Python? Asked 12 years, 3 months ago Modified 1 year, 1 month ago Viewed 96k times