Day 9 文件处理 File handling

day 9思维导图

一 字符编码中pyrhon的应用

Encoding in python

如何保证不乱码

use UTF-8(Most ide solve this problem for us)

use'# coding="gbk"' at the first line of the program

如何在python中定义字符串

we could type an "u" before the string in python2

we don't need to do this in python3

bytes类型

We could use encode() command to convert str into bytes

and decode() for bytes to str

二 文件处理的打开模式

See Day 8

原文地址:https://www.cnblogs.com/fengshili666/p/14189115.html