 大家應(yīng)該對(duì)GitHub 都不陌生。使用R的小伙伴應(yīng)該會(huì)經(jīng)常從github上安裝相關(guān)的R包。實(shí)際上GitHub 是一個(gè)面向開源及私有軟件項(xiàng)目的托管平臺(tái),因?yàn)橹恢С?Git 作為唯一的版本庫格式進(jìn)行托管,故名 GitHub。 GitHub 于 2008 年 4 月 10 日正式上線,除了 Git 代碼倉庫托管及基本的 Web 管理界面以外,還提供了訂閱、討論組、文本渲染、在線文件編輯器、協(xié)作圖譜(報(bào)表)、代碼片段分享(Gist)等功能。除了能存儲(chǔ)R包相關(guān)的內(nèi)容,上面還有很多有意思的項(xiàng)目。今天小編就跟大家分享一下Github上面小星星最多的30個(gè)項(xiàng)目。這里的小星星越多證明大家認(rèn)為這個(gè)項(xiàng)目越有價(jià)值。下面是獲取信息的python代碼,感興趣的可以自己去運(yùn)行一下import requests import pygal
# 執(zhí)行API調(diào)用并存儲(chǔ)響應(yīng)? url = 'https://api.github.com/search/repositories?q=language:python&sort=stars' r = requests.get(url) #print("Status code:", r.status_code) # 將API響應(yīng)存儲(chǔ)在一個(gè)變量中 response_dict = r.json() # 處理結(jié)果 #print(response_dict.keys()) print("Total repositories:", response_dict['total_count']) # 探索有關(guān)倉庫的信息 repo_dicts = response_dict['items'] print("Repositories returned:", len(repo_dicts))
print("\nSelected information about each repository:") with open('python_most_popular_github.txt', 'w',encoding='utf-8') as f: for repo_dict in repo_dicts: f.write('Name:'+ repo_dict['name']) f.write('\tOwner:'+ repo_dict['owner']['login']) f.write('\tStars:'+ str(repo_dict['stargazers_count'])) f.write('\tRepository:'+ repo_dict['html_url']) f.write('\tDescription:'+ str(repo_dict['description'])+'\n')
|