Skip to content

Key error #582

Answered by eculler
allenmoench asked this question in Q&A
Nov 2, 2024 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

@allenmoench it looks to me like the problem here is that your dictionary keys are not matching what you are pulling out of the file name. And it looks to me like the reason for that is that you are missing the last character in the band name! Notice that it's looking for 'B0', rather than 'B0x'.

In Python, when you index a range, it does not include the end of the range. That means you have to go one past what you might think. In this case, your end_index will need to be -4 in order to include the character at index -5.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@allenmoench
Comment options

allenmoench Nov 3, 2024
Collaborator Author

Comment options

You must be logged in to vote
0 replies
Answer selected by allenmoench
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants