我如何从Github启动这个PythonProject?

2024-04-18 23:47:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我从Python开始,看了一些教程并下载了python3.6。现在我想看看一些示例项目,在这个LoL项目中遇到了。但不幸的是,我不知道如何开始这个项目。我安装了它pip install riotwatcher,接下来是“使用它”一节 有一个密码。我必须在某处加上这句话吗?还是我必须在这里做什么?我只是个初学者。有人能帮我吗?:)Thx

项目链接:https://github.com/pseudonym117/Riot-Watcher


Tags: installpip项目httpsgithubcom密码示例
1条回答
网友
1楼 · 发布于 2024-04-18 23:47:35

这不是一个项目,而是一个模块/库。这里有一个关于它们是什么的解释:https://docs.python.org/2/tutorial/modules.html。您可以使用库从LoL获取数据,如使用它部分中所述:

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)

你应该安装这个库,然后调用这些函数来处理它。库不是一个项目,你用它来做你的项目。尝试找到一个示例项目,因为在掌握基本知识之前,您不需要太多的外部库,而且OOP一开始有点复杂。如果您想从示例代码中了解有关对象和OOP的更多信息,请查看以下内容:https://python.swaroopch.com/oop.html,但我建议您从基础知识开始,在一些示例项目中尝试此站点:http://www.pythonforbeginners.com/code-snippets-source-code/python-code-examples

相关问题 更多 >