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 …

  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 …

  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 …

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

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

    Aug 9, 2012 · That's because semantic versions and python versions have a slightly different definition. The packaging.version is meant to compare python package versions, not semantic …

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

    Jun 16, 2012 · There's the != (not equal) operator that returns True when two values differ, though be careful with the types because "1" != 1. This will always return True and "1" == 1 will always …

  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 …

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

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

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

  10. How to compare string enums in python - Stack Overflow

    May 12, 2023 · How to compare string enums in python Asked 2 years, 9 months ago Modified 2 years, 9 months ago Viewed 2k times