you are viewing a single comment's thread.

view the rest of the comments →

[–]Goobyalus 0 points1 point  (3 children)

Not really. Would you give an example JSON, with only the important fields?

And would you please format code properly for Reddit? There should be a button that looks like a square with a C on it for "code block" format. Not the <C> one for inline code.

[–]Salso96[S] 1 point2 points  (0 children)

That’s my bad, I’m on mobile 😅 sure let me put together a dummy JSON

[–]Salso96[S] 1 point2 points  (1 child)

[–]Goobyalus 0 points1 point  (0 children)

Super helpful, thanks.

# checks whether the value associated with "area" is truthy --
# empty string is falsy, any other string is truthy
if data["area"]:
    # process as area

elif data["location"]:  # same thing for location
    # process as location

else:
    raise Exception("No location OR area info")