40823149

  • Home
    • Site Map
    • reveal
    • blog
  • stage1-7
    • 小組-1
    • w1
    • w2
    • w3
  • stage2-7
    • 小組-2
    • w5
    • w6~w7
  • stage3-6
    • 小組-3
    • w10
      • task1
      • task2
    • w11   Task2
      • stage1-6 remote API
      • stage2-7 remote API
    • w13~w14
      • gitlab
    • w15
      • Video and subtitle translation-1
      • Video and subtitle translation-2
    • w16
      • Onshape 零組件繪製
      • 建立 CoppeliaSim 4.1.0 MTB robot 場景
      • 手臂末端加入 components-gripper-suction pad 吸盤
      • 逆向運動學
      • Python remote API 逆向運動學函式
    • w17
      • stage3-ag6
      • 國立虎尾科技大學 - 機械設計工程系 - 協同產品設計實習 - 期末報告 - 學號40823149
w10 << Previous Next >> task2

task1

參考40823131和40823136

# open file, default is read mode, since txt content no chinese char
#打開文件,默認為讀取模式,因為txt內容無中文字符
# no encoding = "UTF-8" is needed
#無需編碼=“ UTF-8”
with open("stage3_2a.txt") as ab: 
    #開啟檔案stage3_2a.txt並命名為ab
    data = ab.readlines()
    #將ab=stage3_2a.txt的資料讀取檔案,使用readline()讀取檔案中所有內容或是從檔案中讀取一行資料
    data = [a.replace('4823122','40823122') for a in data]
    #有一組學號錯誤更換( replace) 成新的學號
    #這字串replace ('4823122',40823122')命名為data,然後for-loop到data中修改
    #40823122修該成4823122
    data = [b.replace('\t\t','') for b in data]
      #因為有一組有六個人比別組少2個人,把四個空格刪除
      #(\t\t代表一個人)
     #print(data)
print(len(data))
#說明有幾個元素
for i in range(len(data)):
    #假設一個範圍len(data)=6,變數為自行假設(i),從0開始加到5,一直循環,每次加1 [0,1,2,3,4,5]
    group = data[i].rstrip("\n").split("\t") 
    #data[0]='stage3_ag1\t...',data[1]='stage3_ag2\t...',.......
    #先取出data list中的第i項進行處理,刪去元素中\n ,再利用\t進行切割,找出新的列表group
    #[rstrip(\n)=刪除字符串中結尾處,位於\n刪除序列的符號][split()=通過指定分隔符對字串進行切片]
    print('<p>'+group[0]+' | <a href="https://'+group[1]+'.github.io/stage3-ag'+group[0][9]+'">Website</a> | <a href="https://github.com/'+group[2]+'/stage3-ag'+group[0][9]+'">Repository</a></p>')
    #group[0]=組名
    #group[0][9]=取得組序
    #將 group list(串列)中的元素,將網站跟倉儲依序印出來 
    for j in range(2,18,2):
        #設一個範圍,以2為起始每次加2加到<18,就是執行迴圈8次
        try:
            print('<p>'+group[j]+' | Website:'+'<a href="https://'+group[j]+'.github.io/cd2021'+'">'+group[j]+'</a>'+' | Repository:'+'<a href="https://github.com/'+group[j]+'/cd2021'+'">'+group[j]+'</a> </p>')
          #group[j]=組員學號,j=2時學號為組長
          #將 group list(串列)中的元素,將網站跟倉儲依序印出來        
        except:
          continue
           #for 迴圈會將range都跑完,所以要執行到最後一次才會跳出循環
           #這邊使用try.....except,因為有一組6個人,如果沒用會出現error out of range(超出範圍),最後用continue是要讓迴圈繼續跑

stage3_ag1 | Website | Repository

40823131 | Website:40823131 | Repository:40823131

a40823112 | Website:a40823112 | Repository:a40823112

40823123 | Website:40823123 | Repository:40823123

40823145 | Website:40823145 | Repository:40823145

40823136 | Website:40823136 | Repository:40823136

40823109 | Website:40823109 | Repository:40823109

40823116 | Website:40823116 | Repository:40823116

40823108 | Website:40823108 | Repository:40823108

stage3_ag2 | Website | Repository

40823151 | Website:40823151 | Repository:40823151

40623121 | Website:40623121 | Repository:40623121

40871106 | Website:40871106 | Repository:40871106

40823102 | Website:40823102 | Repository:40823102

40823104 | Website:40823104 | Repository:40823104

40823106 | Website:40823106 | Repository:40823106

40823101 | Website:40823101 | Repository:40823101

40823132 | Website:40823132 | Repository:40823132

stage3_ag3 | Website | Repository

40823119 | Website:40823119 | Repository:40823119

40823150 | Website:40823150 | Repository:40823150

40823103 | Website:40823103 | Repository:40823103

40823107 | Website:40823107 | Repository:40823107

40523252 | Website:40523252 | Repository:40523252

40823154 | Website:40823154 | Repository:40823154

stage3_ag4 | Website | Repository

40823142 | Website:40823142 | Repository:40823142

40823144 | Website:40823144 | Repository:40823144

40823127 | Website:40823127 | Repository:40823127

40823148 | Website:40823148 | Repository:40823148

40823121 | Website:40823121 | Repository:40823121

40823135 | Website:40823135 | Repository:40823135

40823114 | Website:40823114 | Repository:40823114

40823146 | Website:40823146 | Repository:40823146

stage3_ag5 | Website | Repository

40823111 | Website:40823111 | Repository:40823111

40823115 | Website:40823115 | Repository:40823115

40823128 | Website:40823128 | Repository:40823128

40823120 | Website:40823120 | Repository:40823120

40823140 | Website:40823140 | Repository:40823140

40823124 | Website:40823124 | Repository:40823124

40823139 | Website:40823139 | Repository:40823139

40823126 | Website:40823126 | Repository:40823126

stage3_ag6 | Website | Repository

40823152 | Website:40823152 | Repository:40823152

40823110 | Website:40823110 | Repository:40823110

40823122 | Website:40823122 | Repository:40823122

40823125 | Website:40823125 | Repository:40823125

40823117 | Website:40823117 | Repository:40823117

40823129 | Website:40823129 | Repository:40823129

40823149 | Website:40823149 | Repository:40823149

40823153 | Website:40823153 | Repository:40823153


w10 << Previous Next >> task2

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