一:編寫程序

現(xiàn)如今有4組秒表記錄的數(shù)據(jù),分別如下:

  1. james.txt:2-34,3:21,2.34,2.45,3.01,2:01,2:01,3:10,2-22

  2. julie.txt:2.59,2.11,2:11,2:23,3-10,2-23,3:10,3.21,3-21

  3. mikey.txt:2:22,3.01,3:01,3.02,3:02,3.02,3:22,2.49,2:38

  4. sarah.txt:2:58,2.58,2:39,2-25,2-55,2:54,2.18,2:55,2:55

1.需要從各個(gè)文件將數(shù)據(jù)讀入各自的列表,編寫一個(gè)小程序,處理每個(gè)文件,為每個(gè)數(shù)據(jù)創(chuàng)建一個(gè)列表,并在屏幕上顯示這些列表

james.txt

大數(shù)據(jù)培訓(xùn),云培訓(xùn),數(shù)據(jù)挖掘培訓(xùn),云計(jì)算培訓(xùn),高端軟件開發(fā)培訓(xùn),項(xiàng)目經(jīng)理培訓(xùn)

In [1]: with open('james.txt',"r") as jam:
   ...:     data=jam.readline()
   ...: james=data.strip().split(",") 
#strip():去除空白換行符#split():
        
		

網(wǎng)友評論