python 相关随笔记

python代码默认规则,开发时,建议一行代码不要超过80个字符,如果超过,可按以下形式编写

with open("testfilename","r",encoding='utf-8') as f ,\
            open("otherfile","r",encoding='utf-8') as f2:
        for line in f:
            #. . .
View Code

 ----------------------------------------------------------------------------------------------------------------------------------------------------------

unicode 包含 ASCII 

一个字母 在ASCII码中占用 一个字节=8个byte位

一个中文 在unicode 码中占用两个字节=16个byte位

utf-8 相对 unicode 和 ASCII 来说 utf-8 是可变长字符集

utf-8 是unicode 的拓展字符集

posted @ 2019-10-18 11:20  田园先生  阅读(77)  评论(0)    收藏  举报