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

    58 How do Python's any and all functions work? any and all take iterables and return True if any and all (respectively) of the elements are True.

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

    Generally speaking: all and any are functions that take some iterable and return True, if in the case of all, no values in the iterable are falsy; in the case of any, at least one value is truthy. A …

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

    Oct 2, 2016 · Yes, there is a difference. Although in Python 3, all objects are instances of object, including object itself, only Any documents that the return value should be disregarded by the …

  4. How does this input work with the Python 'any' function?

    If you had created a list comprehension, Python would first have had to create the billion-element list in memory, and then pass that to any. But by using a generator expression, you can have …

  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. How to check if a string contains an element from a list in Python

    if any(ext in url_string for ext in extensionsToCheck): print(url_string) EDIT: I see this answer has been accepted by OP. Though my solution may be "good enough" solution to his particular …

  7. python - Check if string ends with one of the strings from a list ...

    Aug 21, 2013 · @ilyail3: I suspect the goal is to push people towards efficient constructs. 99% of the time, the suffixes to test are constant string literals. If you put them in a list, the CPython …

  8. python - How can I check if a string contains ANY letters from the ...

    Jan 31, 2012 · 129 What is best pure Python implementation to check if a string contains ANY letters from the alphabet?

  9. python - How can I write a `try`/`except` block that catches all ...

    In Python, all exceptions must be instances of a class that derives from BaseException, but if you can omit it for a general case - omit it, problem is, linters wine about it.

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