Networking Transfer Protocols 網絡傳輸協議 <<
Previous Next >> HW3
HW2
#先import urllib.request 然後抓取網址
import urllib.request
target_url = "https://nfulist.herokuapp.com/?semester=1091&courseno=0776"
#建立數列
cp1b = []
#將資料用append語法cp1b放進中 decode("utf-8")可解讀中文
for line in urllib.request.urlopen(target_url):
cp1b.append(int(line.decode('utf-8').rstrip()))
在random模組 載入亂數分組模組shuffle
from random import shuffle
shuffle(cp1b)
n = 5
m = int(len(cp1b)/n)
list2 = []
for i in range(0,len(cp1b),m):
list2.append(cp1b[i:i+m])
print(list2)
Networking Transfer Protocols 網絡傳輸協議 <<
Previous Next >> HW3