Created
October 20, 2021 11:25
-
-
Save Marceloromeugoncalves/44661c8efdad918ed634ce69cb3e4d44 to your computer and use it in GitHub Desktop.
Lendo dados de um arquivo JSON com Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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