About 458,000 results
Open links in new tab
  1. Does Python have a string 'contains' substring method?

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

  2. 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. …

  3. 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 …

  4. How to use string.replace () in python 3.x - Stack Overflow

    Feb 26, 2012 · The string.replace() is deprecated on python 3.x. What is the new way of doing this?

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

  6. python - How to remove leading and trailing spaces from a string ...

    May 4, 2012 · 5 Should be noted that strip() method would trim any leading and trailing whitespace characters from the string (if there is no passed-in argument). If you want to trim …

  7. 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 …

  8. python - Call method from string - Stack Overflow

    If I have a Python class, and would like to call a function from it depending on a variable, how would I do so? I imagined following could do it: class CallMe: # Class def App(): # Method one ...

  9. How do I get a substring of a string in Python? - Stack Overflow

    Aug 31, 2016 · And just for completeness, Java is like Python in that the String.substring () method takes start and one-past-end. This one just bit me hard, I had assumed it was length …

  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 …