nba.txt
一句:匹配在python
Raptors looking for trade #WetheNorth...
我的代碼:
def nba_tweet(NBA):
with open('nba.txt','r') as f:
for line in f:
if NBA in line:
match=True
if match:
##some_code
if not match:
return []
的問題是,如果我做nba_tweet('Raptors looking for trade #WetheNorth..')
它劇照儘管這一時期的一個從text_file了工作。此外,文本文件是巨大的,但我只是做了顯示我與NBA有問題的文本是從文本文件中的字符串。
什麼是 「作品」 是什麼意思?當你打電話給你時,你會傳遞什麼「NBA」?你真的想把它叫做'nba_tweet(猛禽尋找交易#WetheNorth ..)'*沒有引號*嗎? – doctorlove
@doctorlove @doctorlove我更新了我的代碼,並通過作品我的意思是它仍然顯示與正確的輸出,即使它不假設爲 – CAVS