Find substring in a string : String find « String « Python
- Python
- String
- String find
Find substring in a string
S = 'xxxxSPAMxxxxSPAMxxxx'
where = S.find('SPAM') # search for position
print where # occurs at offset 4
Related examples in the same category