Gxlsystem TIY Editor
Gxlsystem 在线教程
改变方向
暗黑模式
demo_python_ref_string_rfind_vs_rindex.py:
txt = "Hello, welcome to my world." print(txt.rfind("q")) print(txt.rindex("q"))
C:\Users\My Name>python demo_python_ref_string_rfind_vs_rindex.py
-1
Traceback (most recent call last):
File "demo_python_ref_string_rfind_vs_rindex.py", line 4 in <module>
print(txt.rindex("q"))
ValueError: substring not found