Extracting extention form filename:
>>> import os
>>> fileName, fileExtension = os.path.splitext('/path/to/somefile.ext')
>>> fileName '/path/to/somefile'
>>> fileExtension '.ext'#Or just
>>> fileExtension = os.path.splitext('/path/to/somefile.ext')[1]
Find string in another string:
>>> str = "abcdefioshgoihgs sijsiojs "
>>> str.find('a') 0
>>> str.find('g') 10
>>> str.find('s',11) 15
>>> str.find('s',15) 15
>>> str.find('s',16) 17
>>> str.find('s',11,14) -1
Find string in an array:
>>> 'sdfasdf'.index('cc')
Traceback (most recent call last): File "<pyshell#144>", line 1, in 'sdfasdf'.index('cc') ValueError: substring not found
>>> 'sdfasdf'.index('df')
1