Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

string contains element of list python

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

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

'test.jpg'.endswith(extensionsToCheck)   # returns False
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #string #element #list #python
ADD COMMENT
Topic
Name
9+5 =