擅长:python、mysql、java
<pre><code>def find_and_remove(phrases, string_to_find):
for index, phrase in enumerate(phrases):
if string_to_find in phrase:
phrases.pop(index)
break
mylist = ["hello there", "Watermelons are delicious", "What is the colour of my shirt"]
find_and_remove(mylist, "is the colour of")
print mylist
</code></pre>
<p>这里有一种类似的方法来查找和删除<code>string_to_find</code>的第一个实例。你知道吗</p>