40823152網際內容管理

  • Home
    • Site Map
    • reveal
    • blog
  • About
  • Portable Python
  • w1-w3
    • Useing a portable system
    • Create a new portable system
  • W9
    • Bython reads exam scores
  • W10~W12
    • w10
      • www web
    • W11
    • W12
  • W13~W15
    • W13
    • W14
      • Solvespace
    • w15
      • Replit
      • replit_new_repository
  • W16
    • w16_replit
    • get_Meteorological_data
  • W17
    • W17_replit
  • Brython
    • 0. for 1+10
    • 1. Bython reads exam scores
    • 2. get_Meteorological_data
    • test
      • test2
  • Fault
    • Deploy to GitHub Pages
    • invalid path
Create a new portable system << Previous Next >> Bython reads exam scores

W9

get score

1aw5.txt
1aw6.txt
1aw6-2.txt
1aw8.txt
1aw9.txt

step1

利用Byrhon 讀取url中的資料

url = "https://gist.githubusercontent.com/mdecycu/07f0f0817115a68d55d6ca603c5ab393/raw/239f4eb84715978daead6ac1f231af7f190a2a5e/1aw5.txt"
#讀取url取掉跳行
data = open(url).read().split("\n")       
data = data[1:]
for i in data:
    #print(i)
    # ':' 隔開取第一位
    stud = i.split(":")[0]
    # ':' 隔開取第二位
    score =  i.split(":")[1]
    print(stud, score)





Create a new portable system << Previous Next >> Bython reads exam scores

Copyright © All rights reserved | This template is made with by Colorlib