摘要:
在做接口测试时,有时候返回的Json串中显示unicode码,如:‘\u53eb\u6211’,进行反编码后得到其对应的汉字。 f='\u4f18\u8863\u5e93\u4fc3\u9500' print f print(f.decode('unicode-escape')) 结果:优衣库促销 阅读全文
摘要:
#!coding=utf-8 import urllib import urllib2 data='{"":""}' data={data:""} data=urllib.urlencoce(data) url='' request=urllib2.Request(url,data) respons 阅读全文
摘要:
如果我们需要获取字典值的话,我们有两种方法,一个是通过dict['key'],另外一个就是dict.get()方法。今天给大家分享的就是字典的get()方法。这里我们可以用字典做一个小游戏,假设用户在终端输入字符串:"1"或者是"2"或者是"3",返回对应的内容,如果是输入其他的,则返回"error 阅读全文
摘要:
import urllib,urlparseurl = urlparse.urlunsplit(("http","lmbtfy.bangbang93.com","/",urllib.quote("百度一下"),""))print (url) 阅读全文