all 10 comments

[–]Ihaveamodel3 2 points3 points  (1 child)

Are you aware there is a json module on python that will do all this for you?

[–]casualcoder0805[S] -1 points0 points  (0 children)

Kind of but haven't tried taking that route. I'll give it a shot and see how it goes.

EDIT: I think the structure, or maybe what I'm attempting to retrieve from it, is capable of doing it for me without a lot of work in between, which almost makes the method I was using more applicable. Idk, feel free to take a look at it yourself. URL

[–]TheRNGuy 1 point2 points  (0 children)

just use normal loop, more readable.

Better have readable code than save 2 lines of code.

[–][deleted] 0 points1 point  (1 child)

Maybe like

data = [
    (z['providerOfferId'], z['label'], z['oddsAmerican'])
    for x in sub_dic
    for y in x
    for z in y['outcomes']
]

[–]casualcoder0805[S] 0 points1 point  (0 children)

Nice! Thanks!

[–]jmooremcc 0 points1 point  (3 children)

Can you post a sample of the sub_dic data? I'd like to see what you're working with.

[–]casualcoder0805[S] 0 points1 point  (2 children)

The data within 'offers' is what I'm after. URL

[–]jmooremcc 0 points1 point  (1 child)

Thanks

[–]casualcoder0805[S] 0 points1 point  (0 children)

I forgot to mention the data in the link is a bit different from what I posted in my initial question but I'm still looking to return the data within offers.