Cos*_*ech 11 php strpos python-2.7
什么是python相当于:
if (strpos($elem,"text") !== false) {
// do_something;
}
Run Code Online (Sandbox Code Playgroud)
xda*_*azz 32
pos = haystack.find(needle)
pos = haystack.find(needle, offset)
Run Code Online (Sandbox Code Playgroud)
pos = haystack.index(needle)
pos = haystack.index(needle, offset)
Run Code Online (Sandbox Code Playgroud)
要简单地测试子字符串是否在字符串中,请使用:
needle in haystack
Run Code Online (Sandbox Code Playgroud)
这相当于以下PHP:
strpos(haystack, needle) !== FALSE
Run Code Online (Sandbox Code Playgroud)
来自http://www.php2python.com/wiki/function.strpos/
| 归档时间: |
|
| 查看次数: |
23996 次 |
| 最近记录: |