Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- PyQt5
- 리눅스
- 라즈베리파이
- tensorflow
- Unity
- ASP
- MS-SQL
- urllib
- Excel
- port
- python
- 다이어트
- javascript
- Linux
- ubuntu
- 맛집
- 유니티
- pandas
- node.js
- PER
- PyQt
- 함수
- flutter
- MySQL
- mssql
- IOS
- swift
- 날짜
- sqlite
- GIT
Archives
아미(아름다운미소)
python json 송수신 본문
json은 URL요청시 입출력 데이터로 많이 활용됩니다.
예제)
import json import urllib.request url = "http://www.test.com" # URL d = {'name': '테스트', 'birth': '0703', 'age': 47} params = json.dumps(d).encode("utf-8") # encode: 문자열을 바이트로 변환 req = urllib.request.Request(url, data=params, headers={'content-type': 'application/json'}) response = urllib.request.urlopen(req) print(response.read().decode('utf8')) # decode: 바이트를 문자열로 변환
'랭귀지 > python' 카테고리의 다른 글
Python PyQt5 combobox 예제 (0) | 2018.11.26 |
---|---|
python 리스트 슬라이싱 (0) | 2018.11.25 |
[python] pyqt5 QTableWidget (0) | 2018.11.23 |
python 파일 복사 (0) | 2018.11.21 |
[python]print를 로그파일로 생성하기 (0) | 2018.11.18 |
Comments