- 博客(3)
- 收藏
- 关注
原创 新的打开文件模式“x”在python 3中做什么?
而"x"表示以独创模式打开文件,如果文件存在,则引发FileExistsError。使用此模式,您的代码将简单地编写为try: with open("fname", "x") as fout: #Work with your open fileexcept FileExistsError: # Your error handling goes here以前的代码可能是try: with open("fname", "x") as fout:..
2022-04-17 22:08:44
833
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人