这个包提供了一种初始化文件的简单方法。
fileinit的Python项目详细描述
※下面有日语说明
English description
This package provides a simple way to initialize files. You no longer need to check if its directory exists before creating a file!!
How to use
fromfileinitimportfileinitfileinit("./test.txt",# filenameoverwrite=True,init_str="Hello, World!!\n")
Output result: test.txt
Hello, World!!
- If you omit the argument
init_str
, the file will be initialized with empty string""
. - If you set the argument
overwrite
toFalse
and if the file already exists, this package will not do anything.
日语说明
是用于简单初始化文件的软件包。 在创建文件之前不需要确认目录的存在!
简单的使用方法
fromfileinitimportfileinitfileinit("./test.txt",# filenameoverwrite=True,init_str="Hello, World!!\n")
输出结果:test.txt
Hello, World!!
- 如果省略了参数^{cd1>},文件将以空白字符串^{cd2>}初始化。 如果将
- 参数
overwrite
设置为^{cd4>},则如果同名文件已经存在,则不创建新文件。
- 项目
标签: