String nach einem Teilstring durchsuchen
ID | 161 |
---|---|
Link Reference | Not set |
Link Credits | Not set |
Link Technical Documentation | Not set |
PlCodelang | Python |
PlGroup | Strings |
PlItemTitle | String nach einem Teilstring durchsuchen |
Code | # http://www.tutorialspoint.com/python/string_find.htm # this function is case sensitive fullstring = "This is my string" searchFor = "my" startPosition = fullstring.find(searchFor, 0, len(fullstring)) # startPosition will have 8 if startPosition>=0: print "I found it!" startPosition = fullstring.upper().find(searchFor.upper()) # case insensitive |
Result Example |