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

(새 문서: ==개요== ;Python 웹에서 파일 다운로드 <syntaxhighlight lang='console'> # 다운로드 import requests url = 'https://www.facebook.com/favicon.ico' r = requests.get(url, al...)
 
 
(같은 사용자의 중간 판 3개는 보이지 않습니다)
2번째 줄: 2번째 줄:
;Python 웹에서 파일 다운로드
;Python 웹에서 파일 다운로드


<syntaxhighlight lang='console'>
<syntaxhighlight lang='python' run>
# 다운로드
# 다운로드
import requests
import requests
url = 'https://www.facebook.com/favicon.ico'
url = 'https://raw.githubusercontent.com/django/django/main/README.rst'
r = requests.get(url, allow_redirects=True)
r = requests.get(url, allow_redirects=True)
open('facebook.ico', 'wb').write(r.content)
open('README.rst', 'wb').write(r.content)


# 내용 확인
# 내용 확인
f = open('facebook.ico', "r")
f = open('README.rst', 'r')
print(f.read())
print(f.read())
</syntaxhighlight>
</syntaxhighlight>

2021년 7월 13일 (화) 02:31 기준 최신판

1 개요[ | ]

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

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

2 같이 보기[ | ]

3 참고[ | ]

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