分析:Github上排名前6的Python項(xiàng)目

分析:Github上排名前6的Python項(xiàng)目

2019-04-17 21-10-56屏幕截圖.png

1.

排名第一:awesome-python

用途:一個(gè)Python各個(gè)好用的庫的名單。

點(diǎn)評(píng):2019年最用心良苦Pythoner獎(jiǎng)!

2.

排名第二:system-design-primer

用途:學(xué)習(xí)如何設(shè)計(jì)大型系統(tǒng),為系統(tǒng)設(shè)計(jì)的面試做準(zhǔn)備。

點(diǎn)評(píng):“為了面試”,也是醉了......

3.

排名第三:public-apis

用途:一個(gè)優(yōu)質(zhì)網(wǎng)絡(luò)API名單。

點(diǎn)評(píng):果斷收藏!

4.

排名第四:models

用途:This repository contains a number of different models implemented in TensorFlow

點(diǎn)評(píng):AIer們可以收藏一下。

5.

排名第五:flask

用途:Flask is a lightweight WSGI web application framework. (其實(shí)就是你熟悉的那個(gè)Flask)

點(diǎn)評(píng):你會(huì)用Flask嗎?別回答“Python是啥?”。

6.

排名第六:thefuck

用途:Fuck you!Fuck me......難道是一個(gè)抗議項(xiàng)目?不!這個(gè)項(xiàng)目太好用了......

如果輸入了錯(cuò)誤的控制臺(tái)命令,下一條命令輸入fuck就可以幫你修正命令并再次運(yùn)行。

點(diǎn)評(píng):真好用!不知道你的產(chǎn)品經(jīng)理看見你一個(gè)勁輸入fuckfuckfuck不知道他心里會(huì)是什xiang么kai滋chu味ni。

圖表是怎么做出來的?源代碼:

import requests
import pygal


# 獲得網(wǎng)頁數(shù)據(jù)
url = 'https://api.github.com/search/repositories?q=language:python&sort=stars'
r = requests.get(url)
print('Status code:' + str(r.status_code))

# 轉(zhuǎn)化為可讀取的格式
response_dict = r.json()

# print(response_dict.keys())
# print(response_dict['total_count'])

# 獲得主要數(shù)據(jù)
repo_dicts = response_dict['items']

# print(len(repo_dicts))
# repo_dict = repo_dicts[0]

# 統(tǒng)計(jì)出可以制作圖表的數(shù)據(jù)
names, iitems = [], []
for repo_dict in repo_dicts:
    # print('\nName:', repo_dict['name'])
    # print('Owner:', repo_dict['owner']['login'])
    # print('Stars:', repo_dict['stargazers_count'])
    # print('Reposiory:', repo_dict['html_url'])
    # print('Created:', repo_dict['created_at'])
    # print('Updated:', repo_dict['updated_at'])
    # print('Descripion:', repo_dict['description'])
    names.append(repo_dict['name'])
    plot_dict = {
        'value' : repo_dict['stargazers_count'],
        'label' : repo_dict['description'],
        'xlink' : repo_dict['html_url'],
     }
    iitems.append(plot_dict)

# print(len(repo_dict))
# for key in sorted(repo_dict.keys()):
#    print(key)

# 設(shè)置圖表格式、顏色、標(biāo)簽
chart = pygal.Bar(x_label_rotation=45, show_legend=False)
chart.title = 'Github上Python語言中30大最受歡迎的項(xiàng)目的星星數(shù)量排名'
chart.x_labels = names

# 填入數(shù)據(jù)
chart.add('', iitems)
chart.render_to_file('python_repos.svg')    # 保存圖表

學(xué)習(xí)了一下Eric Matthes。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容