| 范围 | 字节数 | 存储格式 |
| 0x0000~0x007F (0 ~ 127) | 1字节 | 0xxxxxxx |
| 0x0080~0x07FF(128 ~ 2047) | 2字节 | 110xxxxx 10xxxxxx |
| 0x0800~FFFF(2048 ~ 65535) | 3字节 | 1110xxxx 10xxxxxx 10xxxxxx |
| 0x10000~1FFFFFF(65536 ~ 2097152) | 4字节 | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx |
| 0x2000000~0x3FFFFFF | 5字节 | 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx |
| 0x4000000~0x7FFFFFFF) | 6字节 | 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx |
>>> open('h.txt','w',encoding='utf-8-sig').write('aaa')
3
>>> open('h.txt','rb').read()
b'\xef\xbb\xbfaaa'
>>> open('h.txt','w',encoding='utf-16').write('bbb')
3
>>> open('h.txt','rb').read()
b'\xff\xfeb\x00b\x00b\x00'
>>> open('hh.txt','w',encoding='utf-16-be').write('ccc')
3
>>> open('hh.txt','rb').read()
b'\x00c\x00c\x00c'
>>> open('h.txt','w',encoding='utf-8').write('ddd')
3
>>> open('h.txt','rb').read()
b'ddd'
>>> open('h.txt','r').read()
'锘縟dd'
>>> open('h.txt','r',encoding='utf-8-sig').read()
'ddd'
>>> ord('中') #20013
>>> chr(20013) #'中'
sys.platform #'win32' sys.getdefaultencoding() # 'utf-8' sys.byteorder #'little' s.isalnum() #s表示字符串 s.isalpha() s.isdecimal s.isdigit() s.isnumeric() s.isprintable() s.isspace() s.isidentifier() #如果字符串可以用作变量名,那么返回True s.islower() s.isupper() s.istitle()
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有