擅长:python、mysql、java
<p>Python<a href="https://docs.python.org/2/library/string.html#string.find" rel="nofollow noreferrer">find(sub)</a>方法返回子字符串子所在的最低索引</strong>,否则返回-1。在</p>
<ul>
<li>在第一段代码中,名称.查找(“Sac”)返回“0”,因为Sachin中“S”的索引是“0”。因此,'if'的主体没有执行。在</li>
<li>在第二段代码中,名称.查找(“sac”)返回“-1”,但是if(-1)为真,因此在执行这段代码中的“if”主体。我希望你现在能理解这个概念。在</li>
</ul>