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 () and ...

    When I run these methods s.isdigit () s.isnumeric () s.isdecimal () I always get as output either all True or all False for each value of s (which is a string). What's the difference between the thr...

  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 string lis...

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

    Why doesn't calling a string method (such as .replace or .strip) modify (mutate) the string? Asked 14 years ago Modified 1 year, 4 months ago Viewed 108k times

  6. 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 intuitive and …

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

    That is, the string provided as an argument is considered as a set of characters, not as a substring. lstrip and rstrip work the same way, except that lstrip only removes characters on the left (at the …

  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 codified in PEP 8 is …

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

  10. python - How to change a string into uppercase? - Stack Overflow

    5 For questions on simple string manipulation the dir built-in function comes in handy. It gives you, among others, a list of methods of the argument, e.g., dir(s) returns a list containing upper.