擅长:python、mysql、java
<p>可以使用<a href="http://www.python.org/dev/peps/pep-0202/" rel="nofollow">List Comprehension</a>将列表转换为小写。</p>
<pre><code>if item in [x.lower() for x in stuff]:
print "found"
else:
print "not found"
</code></pre>
<blockquote>
<blockquote>
<blockquote>
<blockquote>
<p>stuff = ["oranges", "POTATOES", "Pencils", "PAper"]<br/>
print [x.lower() for x in stuff]<br/>
['oranges', 'potatoes', 'pencils', 'paper']</p>
</blockquote>
</blockquote>
</blockquote>
</blockquote>