Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在这里有这段代码可以创建一个文件f = open("data.txt", "w+"),但我也希望它被隐藏,所以我在想可能是这样f = open("data.txt", "wh+")的。
f = open("data.txt", "w+")
f = open("data.txt", "wh+")
根据文档,这些是可用的模式
'r':打开阅读(默认)
'w':打开写入,先截断文件
'x': 独占创建,如果文件已经存在则失败
'a':打开写入,如果存在则追加到文件末尾
'b':二进制模式
't':文本模式(默认)
'+':打开更新(读写)