What does python3 open “x” mode do?

前端 未结 3 1579
情深已故
情深已故 2021-01-01 09:51

What does the new open file mode \"x\" do in python 3?

here is the doc of python 3:

\'r\': open for reading (default)

\'w\': open

3条回答
  •  遥遥无期
    2021-01-01 10:30

    To put simple, opening a file with 'x' mode means:

    Atomically do: (check if exists and create file)

提交回复
热议问题