I have a file that has several lines of animal names followed by numbers like this:
African elephant 6654.000 5712.000 -999.0 -999.0 3.3 38.6 645.0 3 5 3
African giant pouched rat 1.000 6.600 6.3 2.0 8.3 4.5 42.0 3 1 3
Arctic Fox 3.385 44.500 -999.0 -999.0 12.5 14.0 60.0 1 1 1
Arctic ground squirrel .920 5.700 -999.0 -999.0 16.5 -999.0 25.0 5 2 3
Asian elephant 2547.000 4603.000 2.1 1.8 3.9 69.0 624.0 3 5 4
Baboon 10.550 179.500 9.1 .7 9.8 27.0 180.0 4 4 4
.
.
.
I have of list of lists of the data that looks like:
[['African', 'elephant', '6654.000', '5712.000', '-999.0', '-999.0', '3.3', '38.6', '645.0', '3', '5', '3'],
['African', 'giant', 'pouched', 'rat', '1.000', '6.600', '6.3', '2.0', '8.3', '4.5', '42.0', '3', '1', '3'],
['Arctic', 'Fox', '3.385', '44.500', '-999.0', '-999.0', '12.5', '14.0', '60.0', '1', '1', '1'],
['Arctic', 'ground', 'squirrel', '.920', '5.700', '-999.0', '-999.0', '16.5', '-999.0', '25.0', '5', '2', '3'], ... ]
but I need each animal name to be in their own element like:
[['African elephant', '6654.000', '5712.000', '-999.0', '-999.0', '3.3', '38.6', '645.0', '3', '5', '3'],
['African giant pouched rat', '1.000', '6.600', '6.3', '2.0', '8.3', '4.5', '42.0', '3', '1', '3'],
['Arctic Fox', '3.385', '44.500', '-999.0', '-999.0', '12.5', '14.0', '60.0', '1', '1', '1'],
['Arctic ground squirrel', '.920', '5.700', '-999.0', '-999.0', '16.5', '-999.0', '25.0', '5', '2', '3']...]
Is there a way to loop through the list and combine each string of the animal name into one element?
I'm a student in my first semester of Python so I apologize if the answer is obvious.