What is the python equivalent of:
if (strpos($elem,"text") !== false) {
// do_something;
}
pos = haystack.find(needle)
pos = haystack.find(needle, offset)
pos = haystack.index(needle)
pos = haystack.index(needle, offset)
To simply test if a substring is in a string, use:
needle in haystack
which is equivalent to the following PHP:
strpos(haystack, needle) !== FALSE