Mon May 1 23:39:00 UTC 2023 inscode

上级 edde1256
# 导入requests库
import requests
import json
from tabulate import tabulate
import wcwidth
# 导入所需的库
import requests # 发送http请求
import json # 处理json格式数据
import sys
from prettytable import PrettyTable
reload(sys)
sys.setdefaultencoding('utf8')
# 向指定的url发送get请求
response = requests.get('https://ul.ztrztr.top/api/u')
......@@ -13,6 +16,10 @@ print(response.text)
json_data = json.loads(response.text)
json1 = json.dumps(json.loads(response.text), indent=4, sort_keys=False, ensure_ascii=False)
# 定义一个包含超级怪物名称的列表
ultraMobs = ["Queen Ant", "Queen Fire Ant", "Leech", "Ladybug", "Sandstorm", "Roach", "Crab", "Spider", "Moth", "Centipede", "Fly", "Hornet", "Crab", "Shell", "Jellyfish", "Rock", "Beetle", "Bubble", "Dandelion", "Cactus", "Hel Beetle", "Termite Overmind"]
# 遍历超级怪物名称列表并输出每个怪物的名称和所在服务器
for i in ultraMobs :
print(i + ":" + json_data.get("Name: " + i + " Server: NA", "N/A"))
\ No newline at end of file
print(i, ":", json_data.get("Name: " + i + " Server: NA", "N/A"))
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册