Home > other >  Who can help me see where is the problem
Who can help me see where is the problem

Time:01-28

The import requests
The import json
Post_url='https://www.baidu.com/sug'
Headers={' the user-agent ':' Mozilla/5.0 (Windows NT 10.0; Win64. X64; The rv: 84.0) Gecko/20100101 Firefox/84.0 '}
The word=input (' enter a word: ')
data=https://bbs.csdn.net/topics/{
'kw: word
}
The response=requests. Post (url=post_url, data=https://bbs.csdn.net/topics/data, headers=headers)
Dic_obj=response. Json ()
Filename=word + 'json'
Fp=open (filename, 'w', encoding="utf-8")
Json. Dump (dic_obj, fp=fp, ensure_ascii=False)
Print (' over!!!!!! ')
  • Related