About 50 results
Open links in new tab
  1. python - String formatting: % vs. .format vs. f-string literal - Stack ...

    158 Assuming you're using Python's logging module, you can pass the string formatting arguments as arguments to the .debug() method rather than doing the formatting yourself:

  2. Does Python have a string 'contains' substring method?

    Aug 9, 2010 · 573 Does Python have a string contains substring method? 99% of use cases will be covered using the keyword, in, which returns True or False:

  3. string - What's the difference between str.isdigit (), isnumeric () …

    52 The Python documentation notes the difference between the three methods. str.isdigit Return true if all characters in the string are digits and there is at least one character, false otherwise. …

  4. What is the most efficient string concatenation method in Python ...

    Is there an efficient mass string concatenation method in Python (like StringBuilder in C# or StringBuffer in Java)? I found following methods here: Simple concatenation using + Using a …

  5. python - Why doesn't calling a string method (such as .replace or ...

    More broadly, this is true for all Python string methods that change a string's content, e.g. replace, strip, translate, lower / upper, join,... You must assign their output to something if you want to …

  6. string - strip () vs lstrip () vs rstrip () in Python - Stack Overflow

    lstrip, rstrip and strip remove characters from the left, right and both ends of a string respectively. By default they remove whitespace characters (space, tabs, linebreaks, etc)

  7. Split a string by a delimiter in Python - Stack Overflow

    0 When you want to split a string by a specific delimiter like: __ or | or , etc. it's much easier and faster to split using .split() method as in the top answer because Python string methods are …

  8. Can you call multiple methods on one line? - Stack Overflow

    Mar 2, 2015 · 24 result = text.lower().replace(string.punctuation, ' ').split(' ') With great python comes great responsibility: don't abuse this feature! The canonical maximum line length …

  9. How to find all occurrences of a substring? - Stack Overflow

    Follow-up: How to find all occurrences of a substring in a string while ignore some characters in Python?

  10. python - Remove all whitespace in a string - Stack Overflow

    Oct 1, 2016 · All string characters are unicode literal in Python 3; as a consequence, since str.split() splits on all white space characters, that means it splits on unicode white space …