Python: bytes v.s. str

Text is always Unicode and is represented by the str type, and binary data is represented by the bytes type. A string is an abstract representation of text. A string consists of characters, which are also abstract entities not tied to any particular binary representation.The encoding is a way to represent abstract characters in binary data.

bytes v.s str

下面这段话特别有意思:
Which reminds us that, in a different context, even speech itself — language — may be regarded as a form of encoding. In much of early modern philosophy (think of Hobbes and Locke) speech (or language) was basically considered to be an encoding of thoughts and ideas. Communication happens when I encode my thought into language and say something — speak to you. You hear the sound of my words and decode it back into ideas. We achieve communication when I successfully transmit a thought from my mind to your mind via language. You understand me when — as a result of my speech — you have the same idea in your mind as I have in mine.


utf-8
  • !Note: PEP 3120 -- Using UTF-8 as the default source encoding. (Python3
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。