There is a column of data in my Numbers sheet:
Is there a way to export it so that it becomes a list like this, which can be used in Python? I want to use this list for a loop:
['Antrostomus noctitherus','Tringa guttifer','xxx..','xxx..']
If there isn't, are there any other ways to export these data and use in a loop, maybe not making it into a list but something else instead?
I've figured out how to do it.
First, export this column into a CSV file which produce a comma-separated list:
Antrostomus noctitherus,Tringa guttifer,Pitta megarhyncha,Necrosyrtes monachus,Notiomystis cincta,Apteryx mantelli,Gallicolumba platenae,Aythya innotata
Then, add quotation marks on each end, which makes it a string value.
"Antrostomus noctitherus,Tringa guttifer,Pitta megarhyncha,Necrosyrtes monachus,Notiomystis cincta,Apteryx mantelli,Gallicolumba platenae,Aythya innotata"
Put in it python. Use the split() method and add pass ',' to the method, which means using the comma character as separator.
abc="Antrostomus noctitherus,Tringa guttifer,Pitta megarhyncha,Necrosyrtes monachus,Notiomystis cincta,Apteryx mantelli,Gallicolumba platenae,Aythya innotata"
birdNameList=abc.split(',')
The split method split the content around the comma, put them in string, and surround them with a square bracket. This makes it a list.
['Antrostomus noctitherus', 'Tringa guttifer', 'Pitta megarhyncha', 'Necrosyrtes monachus', 'Notiomystis cincta', 'Apteryx mantelli', 'Gallicolumba platenae', 'Aythya innotata']
I double-checked to make sure it's a list by running it in a for loop that prints each item out.