Z
Z
zelsky2016-12-01 21:41:26
Python
zelsky, 2016-12-01 21:41:26

Bug or feature json Python?

def get_group(name):
    for group in data:
        try:
            return group[name]
        except:
            pass

In data I store json.loads of a large file.
That's how it works. But if you put return False instead of a pass at the end, does it return False all the time?
Who will explain why? At first I thought about a large json file, but the problem turned out not to be in it, but just in the except place. Who will explain why?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question