擅长:python、mysql、java
<p>您可以使用<a href="https://docs.python.org/3/library/collections.html#collections.Counter" rel="nofollow noreferrer">Counter</a>。你知道吗</p>
<pre><code>from collections import Counter
cntwords = Counter(list2)
for bacteria in list1:
print(f"{bacteria}: {cntwords[bacteria]}") #using formatted string literals, available since python3.6
</code></pre>