About 50 results
Open links in new tab
  1. String comparison in Python: is vs. == - Stack Overflow

    (In other words it compares value) For JAVA people: In Java, to determine whether two string variables reference the same physical memory location by using str1 == str2. (called object identity, and it is …

  2. python - Why does comparing strings using either '==' or 'is' …

    Two string variables are set to the same value. s1 == s2 always returns True, but s1 is s2 sometimes returns False. If I open my Python interpreter and do the same is comparison, it succeeds: >&...

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

    Many people ask this question when the strings contain representations of numbers, and want to compare the numbers by numeric value. The straightforward solution is to convert the values first. …

  4. python - How do I do a case-insensitive string comparison ... - Stack ...

    How can I compare strings in a case insensitive way in Python? I would like to encapsulate comparison of a regular strings to a repository string, using simple and Pythonic code.

  5. How do I compare two strings in python if order does not matter?

    I have two strings like string1="abc def ghi" and string2="def ghi abc" How to get that this two string are same without breaking the words?

  6. How do I compare version numbers in Python? - Stack Overflow

    Aug 9, 2012 · How do I compare version numbers in Python? Asked 13 years, 6 months ago Modified 7 months ago Viewed 293k times

  7. python - Comparing 2 strings in If,Elif,Else loop - Stack Overflow

    Feb 24, 2017 · You are comparing a list item to a string, which is why your if conditions never evaluate to True. Instead of using the list slice notation split[2:2] which returns a list, you should simply fetch …

  8. Compare strings in python like the sql "like" (with "%" and "_")

    Feb 10, 2023 · The ^ and $ anchors are needed to prevent substring matches; BA1k8301-42 should not match, for example. The re.match() call will only match at the start of the tested string, but using ^ …

  9. Python: Compare strings with 'or' operator - Stack Overflow

    Jun 21, 2016 · Python: Compare strings with 'or' operator [duplicate] Asked 9 years, 7 months ago Modified 9 years, 7 months ago Viewed 5k times

  10. python - string comparison in a while loop - Stack Overflow

    I've written a small piece of code that should detect if there are any matching characters in the same place in the 2 strings. If there is , the score in incremented by 1, if there is 2 or more