【发布时间】:2019-05-12 14:31:15
【问题描述】:
所以我试图关注用户,但问题是它适用于每个用户,除了我在 to_follow.txt 中的最后一个用户:
Chile_Temblores
Aguas_Antof
costaneranorte_
onemichile
Edelaysen
Chilquinta600
CGE_Clientes
Frontel_
EnelClientesCL
javi1597
我使用的代码如下:
def createFriends(api):
accounts = open("to_follow.txt", "r")
friends = api.friends_ids()
print("friends:", friends)
follow = accounts().split('\n')
print (follow)
for account in follow:
if account not in follow:
api.destroy_friendship(account)
for account in follow:
if account not in friends:
print("account: ", account)
fuentes.append(account)
api.create_friendship(account)
print("friendship created")
print(fuentes)
accounts.close()
所以当我打印正在发生的事情时,它会在 javi1597 中停止并且不会退出执行,问题出在哪里?
【问题讨论】:
-
“不退出执行”是什么意思?
-
我的意思是它遵循 javi1597 之前的所有帐户,当它到达这个帐户时,它就像 api.createfriendship 中的“执行”一样
-
可能有其他东西阻止该功能完成吗?例如,
api方法之一?如果createFriends没有为 javi1597 打印“创建的友谊”,那么它正忙于api。 -
就是这样,但我不明白为什么,因为它适用于所有其他用户
-
嗯,您需要查看
api代码是否有问题。
标签: python twitter tweepy friend-function twitter-follow