一:編寫程序
現(xiàn)如今有4組秒表記錄的數(shù)據(jù),分別如下:
james.txt:2-34,3:21,2.34,2.45,3.01,2:01,2:01,3:10,2-22
julie.txt:2.59,2.11,2:11,2:23,3-10,2-23,3:10,3.21,3-21
mikey.txt:2:22,3.01,3:01,3.02,3:02,3.02,3:22,2.49,2:38
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
In [1]: with open('james.txt',"r") as jam: ...: data=jam.readline() ...: james=data.strip().split(",") #strip():去除空白換行符#split():