Join the discussion
Ask questions, share your code and help other Python learners. It's free.
Log in to comment, vote and follow discussions.
Continue with Google
or
Already have an account?
New to Space Python?
Check your inbox
We sent an activation link to . Open it in this browser and you'll come straight back here, logged in.
Nothing after a few minutes? Check your spam folder.
Comments 4
Join the discussion CommentAlready have an account? Log in
Check whether the list has items before indexing. If it's empty, print "Patch: none". An empty list is falsy, so a simple
ifworks.Done, thanks. Chaining
launch["mission"]["patches"][0]["url"]was fun until it wasn't 😄And easier to debug: print each level until you find the one that's missing.
Long chains like that are where real API code breaks. Pull intermediate values into variables — easier to check each level.