#!/usr/bin/env python
import requests
import json
r_json = requests.get('https://myip.ipip.net/json').text
weather_dict = json.loads(r_json)
location = weather_dict.get('data').get('location')
country = location[0]
province = location[1]
city = location[2]
isp = location[4]
def toString():
print('我的國家是:[' + country + ']')
print('我的省份是:[' + province + ']')
print('我的城市是:[' + city + ']')
print('我的運營商是:[' + isp + ']')
toString()
獲得ip的小腳本
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
有遇到過嗎?同樣的規則 Excel 中 比Python 結果大
原創
2024-05-01 09:49:01
這種運行結果裏的10.100000001,怎麼能最快改成10.1?
原創
2024-04-30 21:49:58
通義靈碼實戰系列:一個新項目如何快速啓動,如何維護遺留系統代碼庫?
原創
2024-04-30 21:12:20
Apache DolphinScheduler支持Flink嗎?
原創
2024-04-30 11:49:27
從原始邊列表到鄰接矩陣Python實現圖數據處理的完整指南
原創
2024-04-30 10:34:05
Python爬蟲技術與數據可視化:Numpy、pandas、Matplotlib的黃金組合
原創
2024-04-29 23:26:28
Spring AI 搶先體驗,5 分鐘玩轉 Java AI 應用開發
原創
2024-04-29 21:12:12
1 名工程師輕鬆管理 20 個工作流,創業企業用 Serverless 讓數據處理流程提效
原創
2024-04-28 21:12:22
11個Python循環技巧
原創
2024-04-28 10:33:08
實踐探討Python如何進行異常處理與日誌記錄
原創
2024-04-25 22:33:43
西安站開營!AI 編碼助手通義靈碼幫大學生“整活兒”
原創
2024-04-24 21:12:06
Google Chrome驅動程序 124.0.6367.62(正式版本)去哪下載?
原創
2024-04-24 09:48:52
高效率Python開發工具PyCharm v2024.1——更新AI Assistant功能
原創
2024-04-23 11:34:45
“AI 程序員入職系列”第二彈:如何利用通義靈碼光速改寫項目編程語言?
原創
2024-04-22 21:12:11