Skip to content

Instantly share code, notes, and snippets.

@Marceloromeugoncalves
Created October 20, 2021 11:25
Show Gist options
  • Save Marceloromeugoncalves/44661c8efdad918ed634ce69cb3e4d44 to your computer and use it in GitHub Desktop.
Save Marceloromeugoncalves/44661c8efdad918ed634ce69cb3e4d44 to your computer and use it in GitHub Desktop.
Lendo dados de um arquivo JSON com Python.
import json
with open('posts.json') as f:
posts_json = json.load(f)
for post in posts_json:
title = post['title']
content = post['content']
author_id = post['user_id']
print(f'Title: {title} | Content: {content} | Author Id: {author_id}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment