+ 3

What is the difference Between find( ) and index( ) in Python?

x = 'abcd' print(x.find('c')) print(x.index('c'))

20th Apr 2022, 9:53 AM
Fꫀⲅძ᥆͟ᥙ᥉᯽
Fꫀⲅძ᥆͟ᥙ᥉᯽ - avatar
3 Antworten
+ 6
Quoted from https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/ref_string_find.asp "The find() method is almost the same as the index() method, the only difference is that the index() method raises an exception if the value is not found."
20th Apr 2022, 10:02 AM
Ipang
+ 3
NonStop CODING & Ipang Thanks 👍
20th Apr 2022, 10:27 AM
Fꫀⲅძ᥆͟ᥙ᥉᯽
Fꫀⲅძ᥆͟ᥙ᥉᯽ - avatar