You could use a combination of the csv
module and a list comprehension to store all the floating point voltage values in a list for further processing. The list is created in the context of a with
statement, which will automatically take care of closing the file afterwards, even if an error occurs.
Data from the file is processed by reading it in one line at a time rather than all of it at once, which minimizes memory use during construction of the list regardless of the size file. It would be very easy to extend this to handle the other values and store them in the list, too, or another type of data structure, such as a dictionary.
import csv
with open("data.txt", "rb") as csvfile:
voltages = [float(row['Voltage']) for row in csv.DictReader(csvfile)]
print 'voltages:', voltages
Output:
voltages: [1.003911558621642, 1.0327467181982755, 0.9904463156237306, 0.6867661682528724, 0.6236803073669519, 0.2934711210503298, 0.06148933838536881, 0.07053968550834916, -0.09041720958299812, -0.28273374252040306, -0.29775398016603216]