这个包提供了一种初始化文件的简单方法。

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 to False 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>},则如果同名文件已经存在,则不创建新文件。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java iText字体显示不正确   java使用ApacheFTPClient通过代理连接到FTP服务器   java是在类常量池、字符串池还是年轻一代中为字符串文本分配的空间?GC何时可以访问字符串文字?   java如何读取excel文件并将值设置为null   验证。包含在Java中不用于验证电子邮件格式的(“@”)   两个服务器实例上的java Hibernate主键冲突   java我无法在For循环(JavaFX)中设置按钮文本   单独SocketChannels的java并发读取()对于大型字节缓冲区速度较慢   OpenPDF java分组元素以保持在同一页面上   java将组件放置在任意(x,y)坐标处   java Jackson不会序列化hibernate惰性抓取字段   从Eclipse将带有库的java项目导出到可运行jar   java为什么会出现{错误?   java如何将线性布局(作为子布局)动态添加到约束布局(父布局)?