About 201,000 results
Open links in new tab
  1. What does % do to strings in Python? - Stack Overflow

    I have failed to find documentation for the operator % as it is used on strings in Python. What does this operator do when it is used with a string on the left hand side?

  2. Using "and" and "or" operator with Python strings

    Also the type of the variable parameter is a string. In this context, as I can't imagine a case where usage of boolean operators on strings would make sense, I want to ask the question: Why would one want …

  3. python - Evaluating a mathematical expression in a string - Stack …

    Mar 3, 2010 · Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for int() with base 10: '2^4' I know that eval can work around this, but isn't there a better and - …

  4. Is there a "not equal" operator in Python? - Stack Overflow

    Jun 16, 2012 · There are two operators in Python for the "not equal" condition - a.) != If values of the two operands are not equal, then the condition becomes true. (a != b) is true.

  5. python - How are strings compared? - Stack Overflow

    I'm wondering how Python does string comparison, more specifically how it determines the outcome when a less than < or greater than > operator is used. For instance if I put print ('abc' < ...

  6. String comparison in Python: is vs. == - Stack Overflow

    I noticed a Python script I was writing was acting squirrelly, and traced it to an infinite loop, where the loop condition was while line is not ''. Running through it in the debugger, it turned ou...

  7. operators - What does the percentage sign mean in Python - Stack …

    Apr 25, 2017 · It's an operator in Python that can mean several things depending on the context. A lot of what follows was already mentioned (or hinted at) in the other answers but I thought it could be …

  8. Is it possible to do bitwise operations on a string in Python?

    Aug 20, 2014 · I don't know about bitwise operations on strings but the struct worked great for me. Here's the use case. The SGF file format exists for recording certain games. In the case of Go, …

  9. python - Math operations from string - Stack Overflow

    Nov 13, 2016 · Let's say I have a standard Python string (such as one obtained from raw_input()), maybe "2 + 2" for simplicity's sake. I'd like to convert this string to standard math operations in …

  10. Splitting a string which contains mathematical operators in python

    Oct 1, 2022 · Splitting a string which contains mathematical operators in python Asked 3 years, 2 months ago Modified 3 years, 2 months ago Viewed 682 times