Mar-18-2018, 12:47 PM
I am a total beginner, so likely to be missing something obvious here. First post so be kind!
>>> Looking for ['IAU Name'] in ['IAU Name', 'Designation', 'ID', 'Const.', '#', 'WDS_J', 'Vmag', 'RA(J2000)', 'Dec(J2000)', 'Approval Date']
Next I expected it to set Name_listIndex to match the index at which Name_key is found in headerList. So I was expecting it to set Name_listIndex = 0. Instead I get:
>>> ValueError: ['IAU Name'] is not in list
It works fine using a dummy list and key variable, just not with the real data. I am too confused.
Thanks for any support!
Jenny
print('Looking for ', Name_key, 'in', headerList) Name_listIndex = headerList.index(Name_key)The print function acts out exactly as I expect, giving me confidence that my variables are correctly set:
>>> Looking for ['IAU Name'] in ['IAU Name', 'Designation', 'ID', 'Const.', '#', 'WDS_J', 'Vmag', 'RA(J2000)', 'Dec(J2000)', 'Approval Date']
Next I expected it to set Name_listIndex to match the index at which Name_key is found in headerList. So I was expecting it to set Name_listIndex = 0. Instead I get:
>>> ValueError: ['IAU Name'] is not in list
It works fine using a dummy list and key variable, just not with the real data. I am too confused.
Thanks for any support!
Jenny