import requests #導入網(wǎng)絡模塊 import json #導入數(shù)據(jù)轉(zhuǎn)碼模塊 json轉(zhuǎn)字典 網(wǎng)址='https://v1./?c=d' 接收數(shù)據(jù)=requests.get(網(wǎng)址) #訪問網(wǎng)址獲取數(shù)據(jù)并保存到變量 轉(zhuǎn)碼數(shù)據(jù)=json.loads(接收數(shù)據(jù).text) #將接收的數(shù)據(jù)轉(zhuǎn)為字典格式 print(轉(zhuǎn)碼數(shù)據(jù)['hitokoto']) print(' <'+轉(zhuǎn)碼數(shù)據(jù)['from']+'>') |
|