习惯用php了,Python中查找字符串的函数是什么呢?正向查找find,倒找字符串rfind。代码示例:

pos = haystack.find(needle)
pos = haystack.find(needle, offset)
pos = haystack.rfind(needle)
pos = haystack.rfind(needle, offset)

以上代码参考:
http://www.php2python.com/wiki/function.strpos/
http://www.php2python.com/wiki/function.strrpos/

Related Posts: Python中查找字符串函数-类似PHP-strpos|strrpos :