栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

python打开内置函数:模式a,a +,w,w +和r +之间的区别?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

python打开内置函数:模式a,a +,w,w +和r +之间的区别?

打开模式与

C
标准库功能完全相同
fopen()

BSD
手册
fopen
页对它们的定义如下:

 The argument mode points to a string beginning with one of the following sequences (Additional characters may follow these sequences.): ``r''   Open text file for reading.  The stream is positioned at the         beginning of the file. ``r+''  Open for reading and writing.  The stream is positioned at the         beginning of the file. ``w''   Truncate file to zero length or create text file for writing.         The stream is positioned at the beginning of the file. ``w+''  Open for reading and writing.  The file is created if it does not         exist, otherwise it is truncated.  The stream is positioned at         the beginning of the file. ``a''   Open for writing.  The file is created if it does not exist.  The         stream is positioned at the end of the file.  Subsequent writes         to the file will always end up at the then current end of file,         irrespective of any intervening fseek(3) or similar. ``a+''  Open for reading and writing.  The file is created if it does not         exist.  The stream is positioned at the end of the file.  Subse-         quent writes to the file will always end up at the then current         end of file, irrespective of any intervening 


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/385688.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号