I know how to extract data from a .txt file if it has a certain format (columns with certain spacing) using numpy.loadtxt
, but I'm facing currently a problem a bit more complicating. Let's say a have data of the following format:
*** 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
.
.
.
The relevant information for me are the counts and the gate time. I know I can use open("some txt file", "r")
to read in a txt file, but I don't know how to remove the useless information of each line.