"Python 웹에서 파일 다운로드"의 두 판 사이의 차이

10번째 줄: 10번째 줄:


# 내용 확인
# 내용 확인
f = open('pyproject.toml', "r")
f = open('pyproject.toml', 'r')
print(f.read())
print(f.read())
</syntaxhighlight>
</syntaxhighlight>

2021년 7월 13일 (화) 02:30 판

1 개요

Python 웹에서 파일 다운로드
# 다운로드
import requests
url = 'https://raw.githubusercontent.com/django/django/main/pyproject.toml'
r = requests.get(url, allow_redirects=True)
open('pyproject.toml', 'wb').write(r.content)

# 내용 확인
f = open('pyproject.toml', 'r')
print(f.read())

2 같이 보기

3 참고

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