def main(filename):
print('Importing {}'.format(filename))
group_singular = {
'conifers': [
'conifer', 'plant', 'land plant', 'botany'],
'reptiles': [
'reptile', 'animal', 'cold blood', 'cold bloded', 'vertebrate',
'fauna'],
'turtles (non-marine)': [
'turtle', 'animal', 'non-marine', 'cold blood', 'cold bloded',
'vertebrate', 'fauna'],
'butterflies': [
'butterfly', 'animal', 'insect', 'moths and butterflies', 'fauna',
'invertebrate'],
'dragonflies': [
'dragonfly', 'animal', 'insect', 'dragonflies and damseflies',
'invertebrate', 'fauna'],
'mammals': [
'mammal', 'animal', 'warm blood', 'warm blooded', 'vertebrate',
'fauna'],
'birds': [
'bird', 'animal', 'warm blood', 'warm blooded', 'vertebrate',
'fauna'],
'amphibians': [
'amfibian', 'animal', 'vertebrate', 'fauna'],
'sphingid moths': [
'sphingid moth', 'moth', 'animal', 'insect', 'invertebrate',
'fauna', 'moths and butterflies'],
'bumblebees': [
'bumblebee', 'bee', 'bees', 'animal', 'insect', 'invertebrate'],
}
with open(filename, newline='') as f:
count = 0
# "Scientific Name","Common Name","Family","Taxonomic Group"
for row in csv.reader(f, delimiter=',', quotechar='"'):
count += 1
common = row[1]
if common == 'null':
common = row[0]
gevent.spawn(
post_species, row[0], common,
[row[2], row[3]] + group_singular[row[3].lower()])
if count >= 100:
gevent.wait()
count = 0
gevent.wait()
return 0
评论列表
文章目录