我编写了此Python代码
import urllib.request,json
def main():
data=urllib.request.urlopen("http://selling.alruabye.net/UsersWS.asmx/GetToolType?lng=ar").read()
jsonr=json.loads(data.decode("utf-8"))
#print(jsonr,type(jsonr))
for row in jsonr['ToolData']:
print(row['ToolTypeName'])
if __name__ == '__main__':main()
但是当我想运行它时,出现错误
Traceback (most recent call last):
File "C:/path/PycharmProjects/learnpy/http.py", line 1, in <module>
import urllib.request,json
File "C:\path\Python\Python37-32\lib\urllib\request.py", line 88, in <module>
import http.client
ModuleNotFoundError: No module named 'http.client'; 'http' is not a package
我试图搜索灵魂或导入库,例如:
import urllib
import urllib.request
import json
但对我不起作用,我的Python版本是:3.7.0 我用Pycharm