About 942,000 results
Open links in new tab
  1. python - Compare string with all values in list - Stack Overflow

    I have a string where I am doing a compare with another string to see if there is a match: if paid[j].find(d)>=0: #BLAH BLAH If d were an list, what is the most efficient way to see if the …

  2. string - Comparing two lists in Python - Stack Overflow

    Jul 28, 2012 · list_common = [] for a, b in zip(list_a, list_b): if a == b: list_common.append(a)

  3. python - Comparing strings in a list? - Stack Overflow

    Feb 20, 2020 · I have a set of strings in a list, the list is given below in the code. I would like to compare each string to its previous strings. Obviously the first positioned string will not be …

  4. Compare List & String in Python (2 Examples) - Statistics Globe

    In this tutorial, you’ll learn how to compare a list and a string in Python Programming Language. Comparing a list and a string involves checking if certain elements or patterns exist in both …

  5. Case-insensitive string comparison in Python - GeeksforGeeks

    Apr 22, 2025 · casefold () method in Python performs a case-insensitive comparison that accounts for locale-specific character differences. Explanation: This code uses casefold () for …

  6. String Comparison in Python - GeeksforGeeks

    Oct 29, 2024 · Python supports several operators for string comparison, including ==, !=, <, <=, >, and >=. These operators allow for both equality and lexicographical (alphabetical order) …

  7. How to Compare Strings in Python? - Python Guides

    Sep 24, 2024 · In this tutorial, I will explain how to compare strings in Python using different methods with examples. To compare strings in Python, you can use basic comparison …

  8. Compare Two Lists of Strings in Python (5 Examples) - Statistics …

    In this example, we use both if-else statements and the sorted () function to sort lists to be compared before the comparison. print("The lists have different elements!") # The lists have …

  9. String Comparison in Python: Best Practices and Techniques

    May 21, 2024 · Python's built-in re module provides powerful regular expression functionality to compare and manipulate strings based on complex patterns. There are external libraries like …

  10. String comparison in Python (exact/partial match, etc.) - nkmk …

    Apr 29, 2025 · To check for partial matches, use the in operator, which determines if one string contains another string. x in y returns True if x is contained in y (i.e., x is a substring of y), and …

Refresh