Y
Hacker News
new
|
ask
|
show
|
jobs
by
mhashemi
2964 days ago
That's a great example! Mind if I use it? ;)
1 comments
ziikutv
2964 days ago
You can also use a list comprehension like so.
>>> sum([x['moons'] for x in target['system']['planets']])
link
>>> sum([x['moons'] for x in target['system']['planets']])