"Python 웹에서 JSON 가져오기"의 두 판 사이의 차이

21번째 줄: 21번째 줄:


[[분류: Python JSON]]
[[분류: Python JSON]]
[[분류: Python requests]]

2020년 1월 12일 (일) 14:52 판

1 개요

Python 웹에서 JSON 가져오기
파이썬 인터넷에서 JSON 가져오기
import requests
res = requests.get('https://jsonplaceholder.typicode.com/posts/1')
print(res)
# <Response [200]>
j = res.json()
print(type(j))
# <class 'dict'>
print(j)
# {'userId': 1, 'id': 1, 'title': 'sunt aut facere repellat provident occaecati excepturi opti reprehenderit', 'body': 'quia et suscipit\nsuscipit recusandae consequuntur expedita et cumnreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architeco'}

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}