Line and a line and coding problems

Never had a stroke stroke questions about coding, the occasional problem decode, encode resolved.
Today to sort out the issue of coding. If the error also please point out.

coding

  • Coding system
    we all know that computers store information is stored in binary form, and network transmission of information are also transmitted in the form of bytes. So we see Chinese characters, Chinese is how to do? Here we may think of the ASCII code table, ASCII code specified seven or eight binary combinations to represent 128 or 256 possible characters. As in the ASCII table 65 corresponds to the letters A, then a value of 65 bytes or byte sequence represents the A. Of course, the performance of the English alphabet using a byte is sufficient, a byte character can be represented 256. But the characters in the world far more than 256, so he was born GB2312, GBK, unicode code table variety. Unicode which each character uses two bytes to represent, in theory, can represent 65,536 characters, and contains unicode countries most commonly used characters, to be used as an international code table. The code table code table is used by the system. When storing information or read information are performed by the code table. Different systems have different default code table,
  • Python editor encoding
    First we certainly used in the editing code is the time where the operating system code table. And we begin with the # coding python file = utf-8 statement refers to read using python utf-8 encoding in reading the code of the time.
    Below I will say something about the relationship of unicode and utf-8. python will be the default encoding (Python2 is ascii, Python3 is utf-8), the default encoding means encoding format used when processing a character, but a file for reading, if you do not specify the encoding format, will use the operating the system default encoding format.

emm, to write this now

Guess you like

Origin www.cnblogs.com/dg-blog/p/12581935.html