b模式处理文件
1、读
f=open('cheng','rb') date=f.read() print(date.decode())
2、写
f=open('cheng','ab') f.write('chengzhengdong'.encode('utf-8')) f.close
f=open('cheng','ab') f.write(bytes("chengzhengdong",encoding="utf-8")) f.close
1、读
f=open('cheng','rb') date=f.read() print(date.decode())
2、写
f=open('cheng','ab') f.write('chengzhengdong'.encode('utf-8')) f.close
f=open('cheng','ab') f.write(bytes("chengzhengdong",encoding="utf-8")) f.close