我的完整代码:
import requests as req
import json
Bin = int(300000)
BinMax = int(600000)
File = open("C:/Users/admin/Desktop/PS Now Generaetors/Bins.txt", 'a')
while bin != BinMax:
json1 = req.get("https://lookup.binlist.net/" + str(Bin))
json2 = json1.text
jsonout = json.load(json2)
country = jsonout["country"]
cc = country["alpha2"]
if cc == "US" or "AT" or "BE" or "CA" or "FR" or "De" or "IE" or "JP" or "LU" or "NL" or "CH" or "GB" or "ES" or "IT" or "PT" or "NO" or "DK" or "FI" or "SE" or "PH":
print (bin, "writed")
File.write("\n" + str(Bin) + ";" + cc)
bin =+ 1
完全错误:
Traceback (most recent call last):
File "C:\Users\admin\Desktop\PS Now Generaetors\Bin generator.py", line 10, in <module>
jsonout = json.load(json2)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qbz5n2kfra8p0\lib\json\__init__.py", line 293, in load
return loads(fp.read(),
AttributeError: 'str' object has no attribute 'read'
如何解决?
答案 0 :(得分:0)