Imagine this object:
my_obj = {
'Episodes' : [
{'Tags' : ['one','two','three']},
{'Tags' : ['three','four','five']}
]
}
I want to create a set of the tags:
tags = set(tag for tag in e['Tags'] for e in my_obj['Episodes'])
However, it doesn't work because e is not defined. How can I do it??
tags = set(tag for e in my_obj['Episodes'] for tag in e['Tags'])
you need to change the order and get e first... :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With