I have a log file (it is named data.log) containing data that I would like to read and manipulate.
The file is structured as follows:
'''
#Comment line 1
#Comment line 2
1.00000000,3.02502604,343260.68655952,384.26845401,-7.70828175,-0.45288215
2.00000000,3.01495320,342124.21684440,767.95286901,-7.71506536,-0.45123853
3.00000000,3.00489957,340989.57100678,1151.05303883,-7.72185550,-0.44959182
'''
I would like to obtain the numbers from the last two columns and convert this into separate arrays or lists, I tried doing this by creating an empty list, but I do not know how to make this from a log file with a certain name. Could someone help me with this as I am a beginner programmer?
The expected output I would like to obtain is:
list1 = [-7.70828175, -7.71506536, -7.71506536]
list2 = [-0.45288215, -0.45123853, -0.44959182]
Thank you in advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…