If you are going to sketch it using matplotlib, perhaps the simplest is to use numpy.loadtxt [docs] , because you will have numpy installed anyway:
>>> import numpy >>> d = numpy.loadtxt("mdat.txt", skiprows=2) >>> d array([[ 0. , 0.021], [ 0.1 , 0.021], [ 0.2 , 0.021], [ 0.3 , 0.021], [ 0.4 , 0.021], [ 0.5 , 0.021], [ 0.6 , 0.021]])
Note that I had to add skiprows=2 here to skip the title. Then time d[:,0] and charges d[:,1] , or you can get them explicitly with loadtxt :
>>> times, charges = numpy.loadtxt("mdat.txt", skiprows=2, unpack=True) >>> times array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6]) >>> charges array([ 0.021, 0.021, 0.021, 0.021, 0.021, 0.021, 0.021])