A tool to easily read and write json files, pickle files, binary files, csv files and plain text files.
Project description
fies
下の方に日本語の説明があります
Overview
- A tool to easily read and write json files, pickle files, binary files, csv files and plain text files.
Usage
import fies
# Save json file
fies["./test.json"] = {"hoge": 23, "dummy_data": "fuga"}
# Read json file
print(fies["./test.json"]) # -> {'hoge': 23, 'dummy_data': 'fuga'}
# Save plain text file
fies["./test.txt"] = "hogehoge"
# Read plain text file
print(fies["./test.txt"]) # -> hogehoge
# Save pickle file
fies["./test.pickle"] = [("hoge", 23), 5.7]
# Read pickle file
print(fies["./test.pickle"]) # -> [('hoge', 23), 5.7]
# Save csv file
fies["./test.csv"] = [
["hoge", "fuga"],
[23, True], # Numbers and bool types will be automatically converted to strings.
['Hey, "Escape" man!\n'] # Any line breaks, commas, or double quotation marks will be automatically escaped.
]
Advanced usage
# Save binary file
fies["./test.bin", "binary"] = b"hoge"
# format-specified save
fies["./test.myext", "json"] = {"hoge": 23, "dummy_data": "fuga"}
概要
- jsonファイル, pickleファイル, バイナリファイル, csvファイル, プレーンテキストのファイルを簡単に読み書きできるツールです。
使い方
import fies
# jsonファイル保存
fies["./test.json"] = {"hoge": 23, "dummy_data": "fuga"}
# jsonファイル読み込み
print(fies["./test.json"]) # -> {'hoge': 23, 'dummy_data': 'fuga'}
# プレーンテキストファイル書き出し
fies["./test.txt"] = "hogehoge"
# プレーンテキストファイル読み込み
print(fies["./test.txt"]) # -> hogehoge
# pickleファイル書き出し
fies["./test.pickle"] = [("hoge", 23), 5.7]
# pickleファイル読み込み
print(fies["./test.pickle"]) # -> [('hoge', 23), 5.7]
# csvファイル書き出し
fies["./test.csv"] = [
["hoge", "fuga"],
[23, True], # 数値や真理値型のものは文字列に変換される
['Hey, "Escape" man!\n'] # 改行やカンマ、ダブルクオーテーションがある場合は自動的にエスケープされる
]
発展的な使い方
# バイナリファイル書き出し
fies["./test.bin", "binary"] = b"hoge"
# フォーマット指定書き出し
fies["./test.myext", "json"] = {"hoge": 23, "dummy_data": "fuga"}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fies-1.0.1.tar.gz
(4.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
fies-1.0.1-py3-none-any.whl
(5.4 kB
view details)
File details
Details for the file fies-1.0.1.tar.gz.
File metadata
- Download URL: fies-1.0.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dc4f5624141306a5a86b7ee0e06655d5103a716b95198f83f8db915201181f9
|
|
| MD5 |
ec7abe2d00fe1fb36723a86c7b52bca9
|
|
| BLAKE2b-256 |
834d09af45dfae2e3500856c7685b30324a239d31c356f5a707aea6f829a69fd
|
File details
Details for the file fies-1.0.1-py3-none-any.whl.
File metadata
- Download URL: fies-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e89bbda8979451125d1d331ed8cd1e540407bc4c630b94d3d028e5f136a1a6e
|
|
| MD5 |
a59c6e2ecc5c089c236084565ef079d1
|
|
| BLAKE2b-256 |
54f87ef0f0afc1c4cd7c96c000c2a0ac4738fe2f818761ce66981b6f48365528
|