tweets = re.findall(r "'text':+.*'truncated'", tweets)
print (tweets)
「文」:「RT @premierleague:@韋恩·魯尼的追逐是」,「截斷」:使用正則表達式來檢索特定文本
我有文字的像繩子上面,我想要檢索位於'text': and 'truncated'
之間的推文。
我寫上面的代碼,但收到我使用findall
的鳴叫重複錯誤消息
tweets = re.findall(r "'text':+.*'truncated'", tweets)
^
SyntaxError: invalid syntax
,我想檢索所有從findall
搜索的tweet。
謝謝。
你確定你不想利用你的字符串的json結構並使用'json'模塊嗎? – Jacquot