What is the difference Between find( ) and index( ) in Python? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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
20th Apr 2022, 9:56 AM
NonStop CODING
NonStop CODING - avatar