from riotwatcher import RiotWatcher #Imports the library so you can use it
watcher = RiotWatcher('<your-api-key>') #RiotWatcher is a constructor in the library
my_region = 'na1'
me = watcher.summoner.by_name(my_region, 'pseudonym117') #calls a function on the watcher object
print(me)
my_ranked_stats = watcher.league.positions_by_summoner(my_region, me['id']) #a function of the library
print(my_ranked_stats)
这不是一个项目,而是一个模块/库。这里有一个关于它们是什么的解释:https://docs.python.org/2/tutorial/modules.html。您可以使用库从LoL获取数据,如使用它部分中所述:
你应该安装这个库,然后调用这些函数来处理它。库不是一个项目,你用它来做你的项目。尝试找到一个示例项目,因为在掌握基本知识之前,您不需要太多的外部库,而且OOP一开始有点复杂。如果您想从示例代码中了解有关对象和OOP的更多信息,请查看以下内容:https://python.swaroopch.com/oop.html,但我建议您从基础知识开始,在一些示例项目中尝试此站点:http://www.pythonforbeginners.com/code-snippets-source-code/python-code-examples
相关问题 更多 >
编程相关推荐