001_python字符串简单操作

str

1 re = s1.index('a')
2 # re = s1.index('a',2)
3 re = s1.index('a',2,55)# no out of range
4 # re = s1.index('y')#ValueError: substring not found
5 # lowest index
6 # Raises ValueError
7 print(re)
你好吗?

 

re = s1.index('a')
# re = s1.index('a',2)
re = s1.index('a',2,55)# no out of range
# re = s1.index('y')#ValueError: substring not found
# lowest index
# Raises ValueError
print(re)

 

1 re = s1.index('a')
2 # re = s1.index('a',2)
3 re = s1.index('a',2,55)# no out of range
4 # re = s1.index('y')#ValueError: substring not found
5 # lowest index
6 # Raises ValueError
7 print(re)
index

 

 

1 re = s1.index('a')
2 # re = s1.index('a',2)
3 re = s1.index('a',2,55)# no out of range
4 # re = s1.index('y')#ValueError: substring not found
5 # lowest index
6 # Raises ValueError
7 print(re)

 

posted @ 2020-07-08 10:10  I_PENCIL  阅读(150)  评论(0)    收藏  举报