api = tweepy.API(auth)
# using get_user with id
_id = "103770785"
user = api.get_user(_id)
# printing the name of the user
print("The id " + _id + " corresponds to the user with the name : " + user.name)
这是我的代码。我找不到此消息的解决方案:
TypeError: get_user() takes 1 positional argument but 2 were given
API.get_user
不接受任何位置参数。self
。_id
作为 user_id
kwarg 进行传递。api = tweepy.API(auth)
# using get_user with id
_id = "103770785"
user = api.get_user(user_id=_id)
# printing the name of the user
print("The id " + _id + " corresponds to the user with the name : " + user.name)