speedtest-cli 测试电脑的网络带宽大小

安装

pip install speedtest-cli

我的是 
Successfully installed speedtest-cli-2.1.3

import speedtest、

# 创建测试对象

test = speedtest.Speedtest()

down = test.download()

upload = test.upload()

print(f"上传速度:{round(upload/(1024 * 1024),2)} Mbps")
print(f"下载速度:{round(down/(1024 * 1024),2)} Mbps")


 

posted @ 2021-09-20 14:16  CodeYaSuo  阅读(209)  评论(0编辑  收藏  举报