内容:<p>兄弟,我给你的代码优化了下。
import string
sentence = 'We have some delightful new food in the cafeteria. Awesome!!!'
positive_words = ['awesome','good','nice','super','fun']
negative_words = ['awful', 'lame', 'horrible', 'bad']
positive_words.append('delightful')</p>
<h1 id="del-sentence1">#del sentence1</h1>
<p>print(sentence)
sentence1=sentence.lower()
print(sentence1)</p>
<p>for i in range(len(sentence1)):
if sentence[i] in string.punctuation: sentence1=sentence1.replace(sentence[i],'')
print(sentence1)</p>
<pre class="codehilite"><code>这样可以执行,并没有报错,del那句话没有必要写。</code></pre>
内容:你的 -bash: /usr/bin/pip: 没有那个文件或目录 说明没有pip命令,你试试配置下环境变量试试 ln一下
内容:<p>兄弟,我给你的代码优化了下。 import string sentence = 'We have some delightful new food in the cafeteria. Awesome!!!' positive_words = ['awesome','good','nice','super','fun'] negative_words = ['awful', 'lame', 'horrible', 'bad'] positive_words.append('delightful')</p> <h1 id="del-sentence1">#del sentence1</h1> <p>print(sentence) sentence1=sentence.lower() print(sentence1)</p> <p>for i in range(len(sentence1)): if sentence[i] in string.punctuation: sentence1=sentence1.replace(sentence[i],'') print(sentence1)</p> <pre class="codehilite"><code>这样可以执行,并没有报错,del那句话没有必要写。</code></pre>