+ 1
When I should implement string.index() and where I should implemend string.find() method ?
Both index and string method is returning the same value. string = 'hello world' print(string.index('wo')) print(string.find('wo'))
1 ответ
+ 2
well i guess it is up to u which one u prefer..both do the same thing..the only difference is find() will return -1 if it fails to find ,but index() will raise an exception