40823112 cd2021

  • Home
    • Site Map
    • reveal
    • blog
  • Introduction
  • Collaboration
  • Stage 1
    • W1
      • 利用SSH維護倉儲
      • 建立倉儲
      • 建立Leo編輯Palican
      • 協同倉儲
    • W2
      • Project production
      • 手繪草稿
      • 初步設計與討論
    • W3
      • 錯誤排解 齒輪方向與速度
      • 錯誤排解 傳動改正
      • 產品簡化
      • 完成品
    • W4
      • 2D工程圖
      • 3D爆炸圖
      • 產品設計報告與影片
  • Stage 2
    • W5
      • Stage2 Grouping
      • 進度規劃
    • W6
      • 討論
    • W7
      • Coppeliasim方向鍵操控模擬
      • 模擬問題與排解
    • W8
      • Coppeliasim避障自走車
      • 模擬問題和排解
    • W9
      • 產品報告與模擬影片
  • Stage 3
    • W10
      • Task 1
    • W11
      • task 2-1
      • task 2-2
    • W12
      • 上課直播
    • W13
      • 小組meeting直播
      • RobotDK
    • W14
      • MTB_Robot
    • W15
      • Geometry Translation
      • Algebra Translation
    • W18
    • Final Project
  • W16
  • Product Install
    • stage1-ag10
    • stage2-ag1
    • stage3-ag1
W10 << Previous Next >> W11

Task 1

讀取 stage3_2a.txt , 建立 Stage3 的分組倉儲, 分組網頁, 以及各組員倉儲及網頁連結。

(此程式由Stage3-ag1組長 40823131 所製作)

# open file, default is read mode, since txt content no chinese char4
# no encoding = "UTF-08" is needed
with open("123.txt") as fh:
    #匯入txt內容
    data = fh.readlines()
    data = [a.replace('4823122','40823122') for a in data]
    #由於22號座號打錯少打0,給後傳回data
    data = [b.replace('\t\t\t\t','') for b in data]
    #第三組的組員只有6人,多讀取了四個空格,因此多了四個\t,將其刪除後匯入data
    print(data)
for i in range(len(data)):
    #(len(data))=6,共有六組
    group = data[i].rstrip("\n").split("\t")
    #刪除data中的\n,並將\t作為分隔的依據
    print('<p>'+group[0]+'|<a href="https://'+group[1]+'.github.io/stage3-ag'+group[0][9]+'">網站</a>|<a href="https://github.com/'+group[2]+'/stage3-ag'+group[0][9]+'">倉儲</a></p>')
#用for迴圈增添每個小組的超連結網址
#print : 將字串顯示在螢幕上
#group[0] :文字檔中每一條第一個值、[1]:文字檔中每一條第二個值
#group[0][9]:文字檔中每一條第一個值的第九位
 
    for z in range(2,18,2):
    #range(2,18,2):選取文字檔中的第2格到第18格,每跳兩格選一次
        try:
            print('<p>'+group[z]+'|Website:'+'<a href="https://'+group[z]+'.github.io/cd2021'+'">'+group[z]+'</a>'+'|Repository:'+'<a href="https://github.com/'+group[z]+'/cd2021'+'">'+group[z]+'</a></p>')
            #用for迴圈增添每個組員的超連結網址
            #group[z] : 選取z跳的值
        except:
            continue
            #由於有一組是6人,在執行程式時會超出範圍影響輸出,所以需用try execot解決


W10 << Previous Next >> W11

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