python - file(write operation)
创建文件,并写入数据:
append 数据
Passing ‘w’ to the open() method tells Python to open the file in write mode. In this mode, any data already in the file is lost when the new data is written.
If the file doesn’t exist, Python will create a new file. In this case, a new file named “sample.txt” will be created when the program runs.