在处理中文数据,经常加入下面的代码: 设置python默认字节流编/解码器按照utf8解码方式,把字节流编/解码为unicode; 具体来说,所起到的作用,可以用下面两个错误来解释: UnicodeEncodeError: 'ascii' codec can't encode characters ...
分类:
编程语言 时间:
2019-11-09 21:38:36
阅读次数:
126
python2 1 #python2上所有的字符编码都需要先decode到unicode,再从unicode encode到目标编码 2 str_utf8 = "我就是我" 3 print("str_utf-8:我就是我:",str_utf8) 4 #将utf-8转换为unicode 5 str_u ...
分类:
编程语言 时间:
2019-11-09 10:00:39
阅读次数:
90
>>> a = u'\xb2\xe2\xca\xd4' >>> b = a.encode('raw_unicode_escape') >>> print b 测试 >>> c = a.encode('latin1') >>> print c 测试 unicode.encode(text, encod ...
分类:
编程语言 时间:
2019-11-08 20:56:49
阅读次数:
87
如果收到的HTTP请求参数(URL中的GET请求)中有一个字符串,是中文,比如“10%是黄段子”,服务器段使用URLDecoder.decode就会出现此异常。URL只能使用英文字母、阿拉伯数字和某些标点符号,不能使用其他文字和符号。如果内容中存在中文,必须要进行编解码。“10%是黄段子”转码过后是 ...
分类:
编程语言 时间:
2019-11-08 12:00:00
阅读次数:
112
1、概述 Feign is a declarative web service client. Feign makes writing web service clients easier. Feign has pluggable annotation support including Feign ...
分类:
编程语言 时间:
2019-11-07 19:09:16
阅读次数:
87
Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is be ...
分类:
其他好文 时间:
2019-11-05 13:57:41
阅读次数:
110
redis 类型,数据存在磁盘里面,所以存储速度比较快,其他数据类型还是存储在数据库所以比较慢些 链接redis数据库: r=redis.Redis(host="%%%%%%%",password="HK139bc&*",db=10,decode_responses=True) #port=6379 ...
分类:
数据库 时间:
2019-11-05 09:38:15
阅读次数:
99
"""#最基本,请求地址无参数# response=urllib.request.urlopen("https://www.scetc.edu.cn")## html=response.read().decode("utf-8")## print(html) #第二种,传参数的情况#参数的转换 参数 ...
分类:
编程语言 时间:
2019-11-04 22:01:21
阅读次数:
119
1.前端 JS: 使用 2.后台 帮助类: public static class Base64Helper { /// <summary> /// URL的操作类 /// </summary> static System.Text.Encoding encoding = System.Text.E ...
分类:
Web程序 时间:
2019-11-04 21:43:04
阅读次数:
119
这道题也不是我自己做出来的,只能说大佬牛逼!!! 执行用时 :24 ms, 在所有 python 提交中击败了45.24%的用户 内存消耗 :11.7 MB, 在所有 python 提交中击败了20.90%的用户 ——2019.11.4 ...
分类:
其他好文 时间:
2019-11-04 20:07:04
阅读次数:
73