#encoding:utf-8
import urllib2
import urllib
import re
gjc = urllib.quote("Python") #关键词设置
#print gjc
url = "http://sug.so.360.cn/suggest?callback=suggest_so&encodein=utf-8&encodeout=utf-8&format=json&fields=word,obdata&word="+gjc #URL设置
#headers设置
headers = {
"GET":url,
"Host":"sug.so.360.cn",
"Referer":"http://www.so.com/",
"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36",
}
req = urllib2.Request(url)
for key in headers:
req.add_header(key,headers[key])
html = urllib2.urlopen(req).read()
ss = re.findall("\".*?\"",html)
for item in ss:
print item
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。