我试图搜索用户名的JSON文件,但它只是返回[]而不是tom123。Python搜索文件返回[]
JSON文件的内容:
[{"id":"001788fffe48cbdb","username":"tom123"}]
代码:
import json
import re
import requests
f = open("first.json", "r+")
print(f.read())
username = [index["username"] for index in f.read()]
print(username)
f.close()
谢谢,现在作品:) –