이것은 매우 어리석은 실수 일 수 있습니다. 그러나 나는 잘못 된 것을 볼 수 없습니다.tweepy IndexError :리스트 인덱스가 범위를 벗어났습니다
class listener(tweepy.streaming.StreamListener):
def on_data(self, data):
tweet = data.split(',"text":"')[1].split('","source')[0]
screen_name = data.split(',"screen_name":"')[1].split('","location":')[0]
print tweet
print data
return True
def on_error(self, status):
print status
def main():
twitterStream = tweepy.Stream(auth, listener())
twitterStream.userstream()
if __name__ == "__main__":
main()
및 오류는 다음과 같습니다
이Traceback (most recent call last):
File "C:\Rex\702_EH\new 1.py", line 35, in <module>
main()
File "C:\Rex\702_EH\new 1.py", line 32, in main
twitterStream.userstream()
File "build\bdist.win32\egg\tweepy\streaming.py", line 394, in userstream
File "build\bdist.win32\egg\tweepy\streaming.py", line 361, in _start
File "build\bdist.win32\egg\tweepy\streaming.py", line 294, in _run
IndexError: list index out of range
이 사람이 나를 좀 도와 드릴까요?
응답을위한 Thx이지만이 코드는 KeyError : 'text'를 보여줍니다. 더 이상의 팁? – Rex
또한 제안 사항은 thx이지만이 경우 전환하기에는 너무 늦었을 수 있습니다. – Rex
'decoded.text'또는 'data.text'를 사용해 보시겠습니까? – Efferalgan