About 11,500,000 results
Open links in new tab
  1. How do Python's any and all functions work? - Stack Overflow

    I'm trying to understand how the any() and all() Python built-in functions work. I'm trying to compare the tuples so that if any value is different then it will return True and if they are all the ...

  2. python - Using any () and all () to check if a list contains one set of ...

    For the question in the title: if a list contains one set of values or another it might be more natural to use set operations. In other words, instead of if any(x==playerOne for x in board) or …

  3. python - typing.Any vs object? - Stack Overflow

    Oct 2, 2016 · - Any object is an instance of Any. - Any class is a subclass of Any. - As a special case, Any and object are subclasses of each other. However, a proper typechecker (one that …

  4. python - Pythonic way of checking if a condition holds for any …

    Is there a better way to do this in Python? See also How to check if all elements of a list match a condition? for checking the condition for all elements. Keep in mind that "any" and "all" checks …

  5. any () function in Python with a callback - Stack Overflow

    Jan 6, 2010 · The Python standard library defines an any() function that Return True if any element of the iterable is true. If the iterable is empty, return False. It checks only if the …

  6. python - How to check if a variable matches any item in list using …

    The problem is that any() returns True if any one of the elements in the iterable is True, so your code keeps looping as long as the answer isn't equal to all the strings in months_list —which …

  7. How to check if a string contains an element from a list in Python

    I'm not sure what you mean by your last paragraph. You do want to check if one string from a list of strings (the file extensions) is a substring of another string (the url).

  8. python - Use a.any () or a.all () - Stack Overflow

    Dec 26, 2015 · I have read several posts about a.any () or a.all () but still can't find a way that really clearly explain how to fix the problem. I see why Python does not like what I wrote but I …

  9. Python Any from typing vs generic any - Stack Overflow

    May 22, 2022 · I know by PEP 585 on python 3.9 using generic types vs from the typing module is preferred as most types from typing will be deprecated. So does that also hold for the Any …

  10. python - Opposite of any () function - Stack Overflow

    But is there an elegant way or function in Python that could achieve the opposite effect of any(iterable)? That is, if any bool(element) is False then return True, like the following example: