Case:
# # 1 # # #
"01213456"if Str.find ("All""yes!" else"no!"
# # 2 # # #
"01213456"if Str.find ("All""yes!" else"no!"
The results of the two cases were "yes!", which surprised me very much, 2 should not be no! It?
Here are two points to note :
1. If Str.find (' 23 '): At this point the default is Str.find (' + ')! = 0:
2. The find () function is returned as -1when it is not found.
By reference to the use of:
function Prototypes:find (str, Pos_start, pos_end)
Explain:
- str: searched for "string"
- Pos_start: The first letter position of the lookup (counting from 0 onwards). default: 0)
- Pos_end: The end position of the lookup ( Default-1)
return Value: Returns the location of the first occurrence of the lookup if found: Otherwise, return-1.
Examples of the demonstration:
"0123" print Str.find ("2#"1111print str.find ("1# 0, the first occurrence of the position
Python find () usage