str.index(sub[,start[,end]])
此格式中各参数的含义分别是:
>>> str = "task.lmcjl.com"
>>> str.index('.')
1
>>> str = "task.lmcjl.com"
>>> str.index('z')
Traceback (most recent call last):
File "<pyshell#49>", line 1, in <module>
str.index('z')
ValueError: substring not found
>>> str = "task.lmcjl.com"
>>> str.rindex('.')
11
本文链接:http://task.lmcjl.com/news/6249.html