如果使用 .txt 文件具有特定格式(具有特定間距的列)numpy.loadtxt,我知道如何從 .txt 文件中提取數(shù)據(jù),但我目前面臨一個(gè)更復(fù)雜的問題。假設(shè)有以下格式的數(shù)據(jù):*** model xy *** date: 11.14.18 gate time: 190 sec enviroment Ug= 483 counts time: 09:19:55 enviroment Ug= 777 counts time: 09:21:55 enviroment Ug= 854 counts time: 09:53:55 . . .對(duì)我來說相關(guān)的信息是計(jì)數(shù)和閘門時(shí)間。我知道我可以open("some txt file", "r")用來讀取txt文件,但我不知道如何刪除每一行的無用信息。
從txt文件中提取相關(guān)數(shù)據(jù)
寶慕林4294392
2021-08-17 18:17:09