擅长:python、mysql、java
<p>此处:</p>
<pre><code>wordlist = [':)', ':(', 'happy', 'sad']
tweets = ['I find python cool, it makes me happy :)', 'today is a sad day :(']
for tweet in tweets:
print(' '.join(['1' if word in tweet else '0' for word in wordlist]))
</code></pre>
<p>输出:</p>
<pre><code>1 0 1 0
0 1 0 1
</code></pre>