ツイート (Twitter) のリストを受け取るプロジェクトを作成してから、dictionary
特定の値の単語を含む 内に単語があるかどうかを確認します。単語を取得するコードを取得しましたが、次のような記号を削除する方法がわかりません: , . "
:
コードは次のとおりです。
def getTweet(tweet, dictionary):
score = 0
seperate = tweet.split(' ')
print seperate
print "------"
if(len(tweet) > 0):
for item in seperate:
if item in dictionary:
print item
score = score + int(dictionary[item])
print "here's the score: " + str(score)
return score
else:
print "you haven't tweeted a tweet"
return 0
チェックされるパラメーター/ツイートは次のとおりです。
getTweet("you are the best loyal friendly happy cool nice", scoresDict)
何か案は?