モナーのパイソンでゴーゴー

湘南あたりの海辺より

(*´ω`)外部ライブラリをインストールする

【実行結果】

f:id:ririruby:20200503133341j:plain

【解説】

requestsは外部ライブラリなので先ずは

コマンドプロンプトで以下を入力しインストールする。

py -m pip install requests

次にimport requestsを行う

このプログラムは指定したURLのHTML構造をダウンロード

して表示するものである。

 

【コード】

import requests
response = requests.get('https://www.python.org/download/')
text = response.text
print(text)
 
print(' ∧ ∧  URLの取得')
print('( ゚Д゚)')
print('海と猫が好き')