About 13,100,000 results
Open links in new tab
  1. How to change any data type into a string? - Stack Overflow

    Jul 8, 2010 · The rule of thumb for repr is that if it makes sense to return Python code that could be evaluated to produce the same object, do that, just like str, frozenset, and most other builtins do, but …

  2. Convert bytes to a string in Python 3 - Stack Overflow

    Mar 3, 2009 · 134 If you don't know the encoding, then to read binary input into string in Python 3 and Python 2 compatible way, use the ancient MS-DOS CP437 encoding:

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

  4. How to check if the string is empty in Python? - Stack Overflow

    Does Python have something like an empty string variable where you can do: if myString == string.empty: Regardless, what's the most elegant way to check for empty string values? I find hard …

  5. How do I lowercase a string in Python? - Stack Overflow

    Mar 7, 2023 · Километр In scripts, Python will object to non-ascii (as of Python 2.5, and warning in Python 2.4) bytes being in a string with no encoding given, since the intended coding would be …

  6. python - How to convert string representation of list to a list - Stack ...

    As recent versions of the docs explain: "Warning It is possible to crash the Python interpreter with a sufficiently large/complex string due to stack depth limitations in Python’s AST compiler."

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

    Feb 26, 2012 · Official doc for str.replace of Python 3 official doc: Python 3's str.replace str.replace (old, new [, count]) Return a copy of the string with all occurrences of substring old replaced by new. If the …

  8. python - How to use str.contains () with multiple expressions in pandas ...

    I'm wondering if there is a more efficient way to use the str.contains() function in Pandas, to search for two partial strings at once. I want to search a given column in a dataframe for data that

  9. python - String formatting: % vs. .format vs. f-string literal - Stack ...

    To answer your second question, string formatting happens at the same time as any other operation - when the string formatting expression is evaluated. And Python, not being a lazy language, …

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