나는 Twittter API와 파이썬잡아 트윗 UnicodeEncodeError
내가 로그인과 결과 사전을 얻을 수의 OAuth를 사용를 사용하여 트윗의 텍스트를 잡기 위해 노력하고 발생 0] 사전입니다 : 등
{u'contributors': None, u'truncated': False, u'text': u'RT @Kagame_quotes: "We, the people of #Rwanda, our country has its own problems that we can\u2019t attribute to others, we need to find solution\u2026', u'in_reply_to_status_id': None, u'id': 387905246028394496L, u'favorite_count': 0, u'source': u'<a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>', u'retweeted': False, u'coordinates': None,
...
나는 단지 u'text'
키에 대한 값을 잡아하려는 (즉 트윗을 얻을) 0
for item in list:
print item[u'text']
을하지만 그것은 나에게 오류 제공합니다 : 그래서 쓰기
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019'
in position 91: ordinal not in range(128)
가 어떻게이 u'text'
키에 대한 값을 잡을 수 있습니까? 트릭을 할해야
for item in list:
print item[u'text'].encode('utf-8')
:
변수 이름으로'list'를 사용하지 마십시오 . –