所以我到处搜索,所有提供给我的解决方案都发布了一条新推文,但实际上并没有回复我收集的推文。我的目标是让脚本回复我检索到的 2 条推文,但由于某种原因没有任何效果,如果有人可以帮助解决这个问题,我将非常感激。
while True:
for tweet in tweepy.Cursor(api.user_timeline,
since='2017-12-24',
screen_name='something'
).items(2):
try:
if not tweet.retweeted:
tweet.retweet()
m = "Something"
t = api.update_status(status=m, in_reply_to_status_id=tweet.id)
print("Something, Working...")
sleep(10)
except tweepy.TweepError as e:
print(e.reason)
sleep(5)
break
except StopIteration:
break
Run Code Online (Sandbox Code Playgroud)
我尝试了“in_reply_to_status_id”,正如 tweepy 文档中所述,但它也不起作用,它只是将其发布而不是回复。
所以我有大约1000行文本文档,并想知道是否可以删除Sublime Text上不包含某个关键字的所有行,在我的情况下: @
我正在尝试编写一个简单的coinflip类型游戏,当我运行它时,我得到错误:
if ticket > 50:
TypeError: '>' not supported between instances of 'function' and 'int'
Run Code Online (Sandbox Code Playgroud)
我真的不明白我做错了什么.对我来说似乎一切都很好,但是当我运行它时,它给了我这个我早先写的错误.任何帮助都非常感谢.这是我的代码:
def flip():
if player_ticket > 50:
if ticket > 50:
result = Label(mainFrame, text="YOU WON!!!", fg="green")
result.grid(row=3, columnspan=2)
else:
result = Label(mainFrame, text="YOU LOST!!!", fg="red")
result.grid(row=3, columnspan=2)
else:
if player_ticket < 50:
if ticket < 50:
result = Label(mainFrame, text="YOU WON!!!", fg="green")
result.grid(row=3, columnspan=2)
else:
result = Label(mainFrame, text="YOU LOST!!!", fg="red")
result.grid(row=3, columnspan=2)
def ticket_heads():
global player_ticket
player_ticket = decimal.Decimal(random.randrange(0, 50))
def ticket_tails():
global …Run Code Online (Sandbox Code Playgroud)