Answers for ".contains in list"

1

python list contains string

str in strList

# example
if 'qwe' in strList:
	print('Yes!')
Posted by: Guest on August-19-2021
0

string contains element of list python

extensionsToCheck = ('.pdf', '.doc', '.xls')

'test.doc'.endswith(extensionsToCheck)   # returns True

'test.jpg'.endswith(extensionsToCheck)   # returns False
Posted by: Guest on January-29-2022

Python Answers by Framework

Browse Popular Code Answers by Language