Skip to main content

This package provides a simple way to initialize files.

Project description

※下の方に日本語の説明があります

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

from fileinit import fileinit

fileinit(
  "./test.txt", # filename
  overwrite = 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.

日本語の説明

ファイルを簡単に初期化するためのパッケージです。 もうファイル作成の前にディレクトリの存在を確認する必要はありません!

簡単な使い方

from fileinit import fileinit

fileinit(
  "./test.txt", # filename
  overwrite = True,
  init_str = "Hello, World!!\n"
)

出力結果: test.txt

Hello, World!!

  • 引数init_strを省略した場合、ファイルは空白文字列""で初期化されます。
  • 引数overwriteFalseに設定すると、既に同名のファイルが存在する場合は新たなファイルは作成されません。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fileinit-0.0.2.tar.gz (2.4 kB view hashes)

Uploaded Source

Built Distribution

fileinit-0.0.2-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page