Day 08 character encoding

Character Encoding

Principle text editor, file access

  1. Open a text editor is equivalent to start an application is running in memory, so the contents of the text editor is stored in memory, data loss after power failure.
  2. Want to permanently save, you need to click the Save button, a text editor to store data in memory to the hard disk
  3. When we write a python file when (not performed), there is no difference in nature and write text, edit the characters are in it.

Principle python interpreter to execute py file

  1. Start python interpreter, this time is equivalent to fire up a text editor
  2. Open the file, read the contents of the file, python interpreter equivalent of a text editor
  3. python interpreter to explain the contents of the text, and then have the concept of grammar

Difference python interpreter and text editor

Similarities: the data can be read to the hard disk into memory and displayed to the user to see
different points: python interpreter also performs operations explained

What is the character encoding

The character encoding human character is encoded into a digital computer to recognize

Character encoding that occurs in three stages

  1. Stored memory to the hard disk encode (encoding)
  2. Hard disk memory to fetch decode (decoding)

How to solve the garbage

What saved when encoding, they also get what encoding

python3 interpreter

Pycharm control the lower right corner of the code you write in order to save what encoding format

coding: utf-8 as the time control is python3 text editor to read the text to what encoding format, python3 form of default is utf-8 character reading

python interpreter to explain grammar

Defined as the ratio of variable to explain grammar, will open up a new memory space into this variable, then this variable python3 in the form of unicode storage, such as character x = 'in', and then interpreted by python3 memory becomes x = 10100110010001, theoretically print (x) corresponds to an output 10100110010001, read the programmer is concerned, the founder python3 turtle t do this operation, according to the encoding format encoding 10100110010001 outputs the encoded result of the terminal

Guess you like

Origin www.cnblogs.com/masterjian924/p/10932650.html