-1
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
auth.secure = True
api = tweepy.API(auth)
oo = api.user_timeline(screen_name = 'OpenOutcrier',count=10)
wb = openpyxl.load_workbook('morning.xlsx')
am_sheet = wb.active
for x in oo:
tweettxt = x.text
link2remove = 'http\w+'
relink = re.compile(link2remove)
if relink in tweettxt:
tweettxt = tweettxt.replace(relink, '')
print x.created_at, tweettxt
am_sheet['%s' % ("H" + str(v))].value = tweettxt
v += 1
time.sleep(.1)
time.sleep(1)
wb.save('morning.xlsx')
が見つかりました:はTypeError:Unicodeに強制変換:必要文字列またはバッファ、_sre.SRE_Patternは、私はエラーを取得しています
トラブルこれが動作するようになってを持つFile "C:/Python27/Pyjects/am/morning.py", line 239, in <module>
if relink in tweettxt:
TypeError: coercing to Unicode: need string or buffer, _sre.SRE_Pattern found
...任意の助けをいただければ幸いです。それは何か私は再に間違っていると仮定します。
だろうとそれは〜ありがとうpchaigno – qorka
私は答えを受け入れるために何かを詳述したいですか? – pchaigno