码迷,mamicode.com
首页 > 编程语言 > 详细

Python 编码,str,bytes

时间:2017-02-03 18:16:27      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:编码方式   而且   jpg   tail   class   转换   logs   blog   nbsp   

  1. 什么是明文

    “明文”是可以是文本,音乐,可以编码成mp3文件。明文可以是图像的,可以编码为gif、png或jpg文件。明文是电影的,可以编码成wmv文件。不一而足。
  2. 什么是编码?
    把明文变成计算机语言
    技术分享

  3. 为什么要用Unicode来编码?
    可以记录所有语言,而且编码方式不止一种
    技术分享

  4. python str与bytes之间的转换
  5. # bytes object  
     b = b"example"  
      
     # str object  
     s = "example"  
      
     # str to bytes  
     bytes(s, encoding = "utf8")  
      
     # bytes to str  
     str(b, encoding = "utf-8")  
      
     # an alternative method  
     # str to bytes  
     str.encode(s)  
      
     # bytes to str  
     bytes.decode(b) 

     

Python 编码,str,bytes

标签:编码方式   而且   jpg   tail   class   转换   logs   blog   nbsp   

原文地址:http://www.cnblogs.com/think-and-do/p/6362950.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!