The main contents of this section :
< Span class= "Fontstyle1" >1. Is== the difference
2. encoding problem
? difference between. is and = =
1. ID ()
by ID () we can see the value of the variable table? The address in memory
Note----<<< in python , command? Code and py? The effect of the code shipped in the piece may not be a kind of >>>
SaidWith so much.This oneID ()AndIsWhat's the matter?System?.Attention. Is? moreIs thatID ()The calculated results.Byid Yes, help me.
View data () memory address so is more ( object The memory address most finally we pass is two No
== Double- Judge No et note this double-and so on < Span class= "Fontstyle3" > ? Not memory address < Span class= "Fontstyle3" >
Total Knot :
is more ==
? encoded supplement
1. Python2 silent Yes yards so python2 more coded need to be in the beginning of the piece write :
#-*-Encoding:utf-8-*-
2. Python3 : The Unicode code is in the memory.
Encode backGu:
1.ASCII:EarliestThe encoding.??YesBritish?? writeWord?,?WriteWord?,Digital,?SomeSpecial characters.Not in?,
8A01Code, 8Abit, 1AByte
2.GBK:In?GbCode,?? containsTheAsciiCoding and medium-constant encoding. 16ABit, 2AByte
3.UNICODE:MillionCountryCode,?? containsTheWorldAllCountriesThe encoding of the word. 32ABit, 4AByteContainsThe
Ascii
4.UTF-8:Variable? degreeThe MillionCountryCode.IsUnicodeKind of reality . the most, the character occupies 8 bits.
1. English : 8bit 1byte
2. European Word : 16bit 2byte
3. in? : 24bit 3byte
in addition to ASCII code , other information cannot be converted directly .
InPython3In-memory.InRideOrder shipment?Stage.What makes the?UnicodeCoding.BecauseUnicodeis millionCountryCode.What inside
Can we go in?Explicitly?.So in the dataMass transferWhen you lose and store.ByInUnicode? More wasted SpaceAndResources.Need to put
UnicodeDump intoUTF-8OrGBKinto storage.HowWhat about the conversion?.InPython encode After the content can be entered? lost code . Its also original Data is just coded After performance form hair?
RememberLive: coding results and source string? To The results are based on different coding coded result
also differs we can see utf-8 encoding Yes 3 bytes gbk The encoding is 2 bytes .
Python Basics 06 Coding and small Knowledge points supplement