W3Schools
w3schools.com โบ python โบ ref_func_any.asp
Python any() Function
Remove List Duplicates Reverse ... Python Bootcamp Python Training ... The any() function returns True if any item in an iterable are true, otherwise it returns False....
GeeksforGeeks
geeksforgeeks.org โบ python โบ python-any-function
Python any() function - GeeksforGeeks
July 23, 2025 - It provides a convenient way to determine if at least one element in an iterable is true. ... # Python3 code to demonstrate working of any() # To Check if any element in list satisfies a condition # initializing list test_list = [4, 5, 8, 9, 10, 17] # printing list print("The original list : ", test_list) # Check if any element in list satisfies a condition # Using any() res = any(ele > 10 for ele in test_list) # Printing result print("Does any element satisfy specified condition ?
00:45
Python any() function with strings - YouTube
15:23
Python's ANY and ALL Functions are Simpler Than You Think! - YouTube
05:33
any() Built-In Function With Examples | Python Tutorial - YouTube
17:38
Identifying a Substring Within a Python String - YouTube
15:15
How To Check A String For A Character In Python - YouTube
08:20
How to check if a string contains a substring in Python | Python ...
Programiz
programiz.com โบ python-programming โบ methods โบ built-in โบ any
Python any()
print(any(s)) # 0 is False # '0' is True since its a string character s = '000' print(any(s)) # False since empty iterable s = ''
GeeksforGeeks
geeksforgeeks.org โบ python โบ python-string
Python String - GeeksforGeeks
Strings are sequence of characters written inside quotes. It can include letters, numbers, symbols and spaces. Python does not have a separate character type.
Published ย June 11, 2026
W3Schools
w3schools.com โบ python โบ python_strings.asp
Python Strings
Strings in python are surrounded by either single quotation marks, or double quotation marks. ... print("It's alright") print("He is called 'Johnny'") print('He is called "Johnny"') Try it Yourself ยป ยท Assigning a string to a variable is done with the variable name followed by an equal sign and the string:
Linux Hint
linuxhint.com โบ python_any_function
Python any() function usage โ Linux Hint
The four types of list variables are used here. list1 is an empty list that returns false. list2 contains three string values that return true and an empty value that returns false. list3 contains two zero numbers (0) that return false and a character, โ0โ that returns true. list4 contains three values, one zero that returns false, one false and one empty string that returns zero. So, all values of list4 are false. #!/usr/bin/env python3 # Apply any() on an empty list list1 = [] print("The output of empty list:" ,any(list1)) # Apply any() on a list of string list2 = ['Ubuntu', '', '0', 'Fe
DataCamp
datacamp.com โบ tutorial โบ python-any-function
Python any() Function: Guide With Examples and Use Cases | DataCamp
July 31, 2024 - The any() function in Python returns True if at least one element in an iterable (list, tuple, set, etc.) is true, and False otherwise.
Wiingy
wiingy.com โบ home โบ learn โบ python โบ any() and all() functions in python
Any() and All() Functions in Python (With Examples) - Wiingy
January 30, 2025 - The any() function can also be used with strings. In the example below, we check if any of the strings in the list contain the letter โaโ. 1string_list = ['apple', 'banana', 'orange'] 2contains_a = any('a' in string for string in string_list) 3print
Python
docs.python.org โบ 3 โบ library โบ string.html
Common string operations โ Python 3.14.6 documentation
This value is not locale-dependent and will not change. ... The string '0123456789'. ... The string '0123456789abcdefABCDEF'. ... The string '01234567'. ... String of ASCII characters which are considered punctuation characters in the C locale: !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~. ... String of ASCII characters which are considered printable by Python...
Stanford CS
cs.stanford.edu โบ people โบ nick โบ py โบ python-string.html
Python Strings
The formal name of the string type in Python is "str". The str() function serves to convert many values to a string form. This code computes the str form of the number 123: ... Looking carefully at the values, 123 is a number, while '123' is a string length-3, made of the three chars '1' '2' and ...
Google
developers.google.com โบ google for education โบ python โบ python strings
Python Strings | Python Education | Google for Developers
Python has a built-in string class named "str" with many handy features (there is an older module named "string" which you should not use). String literals can be enclosed by either double or single quotes, although single quotes are more commonly used. Backslash escapes work the usual way within both single and double quoted literals -- e.g.
Scaler
scaler.com โบ home โบ topics โบ any() in python | python any() function
any() in Python | Python any() Function - Scaler Topics
March 15, 2022 - Let us dive into the example below to understand the concept explained above. ... The any() in python returns the output as True if any one of the elements in the given iterable object is True.
Top answer 1 of 8
785
Use a generator together with any, which short-circuits on the first True:
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 problem, and is a good general way to check if any strings in a list are found in another string, keep in mind that this is all that this solution does. It does not care WHERE the string is found e.g. in the ending of the string. If this is important, as is often the case with urls, you should look to the answer of @Wladimir Palant, or you risk getting false positives.
2 of 8
89
extensionsToCheck = ('.pdf', '.doc', '.xls')
'test.doc'.endswith(extensionsToCheck) # returns True
'test.jpg'.endswith(extensionsToCheck) # returns False
Programiz
programiz.com โบ python-programming โบ string
Python Strings (With Examples)
For example, "hello" is a string containing a sequence of characters 'h', 'e', 'l', 'l', and 'o'. We use single quotes or double quotes to represent a string in Python.