Task <<
Previous Next >> HW1
hwpages
from browser import html
from browser import document
import random
brython_div = document["brython_div"]
url = "https://gist.githubusercontent.com/mdecourse/b11a88a98655d41055c47f08fe94788f/raw/8a27e6885ee1a5074bcf864d741679afeac796c4/2b_w2_stud_list.txt"
data = open(url).readlines()
# 檢查資料筆數, 第一筆為 title
#print(data)
#print(len(data))
data = data[1:]
#print(data)
# 根據 href 與 content 將 html 元件中的 anchor 插入頁面
def makeLink(href, content):
brython_div <= html.A(content, href=href)
#brython_div <= html.BR()
# 從學員資料中隨機取出 10 位學員的網頁進行查核
select = 10
random.shuffle(data)
data = data[:select]
course = "cad2021"
for i in range(len(data)):
num_github = data[i]
num = num_github.split("\t")[0]
account = num_github.split("\t")[1]
if account == "":
account = num
content = str(num)
hwhref = "https://"+ str(account) + ".github.io/"+course+ "_hw"
repohref = "https://github.com/"+ str(account) +"/"+course +"_hw"
brython_div <= "repo: "
makeLink(repohref, content)
brython_div <= " www: "
makeLink(hwhref, content)
brython_div <= html.BR()
40723126
40723135
40723217
40732331
40823114
40823115
40823117
40823119
40823122
40823127
40823146
40823148
40823215
40871106
40923201
40923203
40923204
40923205
40923206
40923207
40923208
40923209
40923210
40923211
40923212
40923213
40923214
40923216
40923217
40923218
40923219
40923220
40923221
40923223
40923224
40923225
40923226
40923227
40923228
40923229
40923230
40923231
40923232
40923233
40923234
40923235
40923236
40923237
40923238
40923239
40923240
40923241
40923242
40923243
40923244
40923245
40923246
40923247
40923248
40923249
40923250
40923251
40923252
40923253
40971220
40971227
Task <<
Previous Next >> HW1