#一个知识点是: There are two types of string data in Python3, str type and bytes type, sty type stores unicode data, Bytes type stores bytes data
#当我们在word上编辑文件的时候, the data is stored in memory in Unicode form before it is saved.
#当我们点击保存时, the data will be encoded by the editor (such as UTF-8, GBK) encoding bytes byte string stored on the hard disk, the advantage is to save storage space------encode
#当我们又重新打开文件时, Word also places these bytes byte-string decoding city Unicode forms in memory, and the data is presented to us in clear text---------decode
1 ImportJSON2s='Fong Fong'3 Print(Type (s))#<class ' str ' >4 Print(Repr (s))#Show Store Contents # ' Fang Fang '5 Print(Json.dumps (s))#"\U82B3\U82B3"; json.dumps converts data into a string that is known to all programming languages in a special way6 7B=s.encode ("Utf-8")8 Print(type (b))#<class ' bytes ' >9 Print(repr (b))#b ' \xe8\x8a\xb3\xe8\x8a\xb3 'Ten OneU=b.decode ("Utf-8") A Print(Type (U))#<class ' str ' > - Print(Repr (U))#' Fang Fang ' - Print(Json.dumps (U))#"\U82B3\U82B3"
Encoding and decoding in Python3