I have a series of lists created from an imported file with numerous lines of data. However, when creating the list from the file, a list was also created for the headings. I have managed to delete the headers from the first list but have now been left with:
['', '', '', '']
['2.3', '82.2', '0.6', '1.5']
['3.6', '92.9', '0.5', '2.1']
['6.3', '82.9', '0.7', '2.1']
['7.0', '70.8', '0.5', '1.8']
['7.7', '56.3', '0.4', '2.0']
['8.3', '97.0', '0.8', '1.8']
['10.4', '67.0', '0.6', '1.5']
['11.8', '89.3', '0.7', '1.4']
['13.0', '75.8', '0.8', '1.3']
['14.1', '77.1', '0.6', '1.7']
['15.8', '74.6', '0.6', '1.8']
['16.9', '69.0', '0.4', '2.5']
['18.4', '89.9', '0.6', '2.4']
['20.3', '93.5', '0.9', '2.3']
['21.4', '80.9', '0.6', '1.9']
['21.9', '81.6', '0.9', '2.2']
['23.5', '65.0', '0.6', '2.5']
['24.4', '78.4', '0.4', '1.8']
['27.2', '81.5', '0.7', '2.3']
['28.8', '73.4', '0.4', '1.7']
Code:
def createPersonList(fileName):
theFile = open(fileName)
for line in theFile:
aList = line.split(',')
bList = map(lambda s: s.strip('\n'), aList)
cList = map(lambda s: s.strip('ArrivalTime (s)'' Weight (kg)'' gait (m)' ' speed (m/s)'), bList)
print cList
Input:
>>>createPersonList('filename')
I would like to completely delete/remove the first list ['', '', '', '']
but am struggling to do so.