Name | fies JSON |
Version |
1.4.0
JSON |
| download |
home_page | https://github.co.jp/ |
Summary | A tool to easily read and write json files, pickle files, binary files, csv files and plain text files. |
upload_time | 2024-02-26 04:49:48 |
maintainer | |
docs_url | None |
author | le_lattelle |
requires_python | |
license | CC0 v1.0 |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# fies
下の方に日本語の説明があります
## Overview
- A tool to easily read and write json files, YAML files, pickle files, binary files, csv files and plain text files.
## Usage
```python
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.
]
# Save YAML file
fies["./test.yml", "yaml"] = {"hoge": {"fuga": 13, 77: [1,2]}}
```
## Advanced usage
```python
# Save binary file
fies["./test.bin", "binary"] = b"hoge"
# format-specified save
fies["./test.myext", "json"] = {"hoge": 23, "dummy_data": "fuga"}
# Recursive Enumeration of Files (Returns a list of absolute paths)
print(fies["./input_dir/"].all())
print(fies["./input_dir/"].rec()) # This notation works the same as above
```
## 概要
- jsonファイル, YAMLファイル, pickleファイル, バイナリファイル, csvファイル, プレーンテキストのファイルを簡単に読み書きできるツールです。
## 使い方
```python
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'] # 改行やカンマ、ダブルクオーテーションがある場合は自動的にエスケープされる
]
# yamlファイル書き出し
fies["./test.yml", "yaml"] = {"hoge": {"fuga": 13, 77: [1,2]}}
```
## 発展的な使い方
```python
# バイナリファイル書き出し
fies["./test.bin", "binary"] = b"hoge"
# フォーマット指定書き出し
fies["./test.myext", "json"] = {"hoge": 23, "dummy_data": "fuga"}
# ファイルの再帰的列挙 (絶対パスのリストが返る)
print(fies["./input_dir/"].all())
print(fies["./input_dir/"].rec()) # この書き方でも上記と同様
```
Raw data
{
"_id": null,
"home_page": "https://github.co.jp/",
"name": "fies",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "le_lattelle",
"author_email": "g.tiger.ml@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f8/70/3569ae3926f6e547faf1c7c510e283988e383f40b227b05cdf9e4b58f05f/fies-1.4.0.tar.gz",
"platform": null,
"description": "# fies\n\n\u4e0b\u306e\u65b9\u306b\u65e5\u672c\u8a9e\u306e\u8aac\u660e\u304c\u3042\u308a\u307e\u3059\n\n## Overview\n- A tool to easily read and write json files, YAML files, pickle files, binary files, csv files and plain text files.\n\n## Usage\n```python\nimport fies\n\n# Save json file\nfies[\"./test.json\"] = {\"hoge\": 23, \"dummy_data\": \"fuga\"}\n\n# Read json file\nprint(fies[\"./test.json\"])\t# -> {'hoge': 23, 'dummy_data': 'fuga'}\n\n# Save plain text file\nfies[\"./test.txt\"] = \"hogehoge\"\n\n# Read plain text file\nprint(fies[\"./test.txt\"])\t# -> hogehoge\n\n# Save pickle file\nfies[\"./test.pickle\"] = [(\"hoge\", 23), 5.7]\n\n# Read pickle file\nprint(fies[\"./test.pickle\"])\t# -> [('hoge', 23), 5.7]\n\n# Save csv file\nfies[\"./test.csv\"] = [\n\t[\"hoge\", \"fuga\"],\n\t[23, True],\t# Numbers and bool types will be automatically converted to strings.\n\t['Hey, \"Escape\" man!\\n']\t# Any line breaks, commas, or double quotation marks will be automatically escaped.\n]\n\n# Save YAML file\nfies[\"./test.yml\", \"yaml\"] = {\"hoge\": {\"fuga\": 13, 77: [1,2]}}\n```\n\n## Advanced usage\n```python\n# Save binary file\nfies[\"./test.bin\", \"binary\"] = b\"hoge\"\n\n# format-specified save\nfies[\"./test.myext\", \"json\"] = {\"hoge\": 23, \"dummy_data\": \"fuga\"}\n\n# Recursive Enumeration of Files (Returns a list of absolute paths)\nprint(fies[\"./input_dir/\"].all())\nprint(fies[\"./input_dir/\"].rec())\t# This notation works the same as above\n```\n\n## \u6982\u8981\n- json\u30d5\u30a1\u30a4\u30eb, YAML\u30d5\u30a1\u30a4\u30eb, pickle\u30d5\u30a1\u30a4\u30eb, \u30d0\u30a4\u30ca\u30ea\u30d5\u30a1\u30a4\u30eb, csv\u30d5\u30a1\u30a4\u30eb, \u30d7\u30ec\u30fc\u30f3\u30c6\u30ad\u30b9\u30c8\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u7c21\u5358\u306b\u8aad\u307f\u66f8\u304d\u3067\u304d\u308b\u30c4\u30fc\u30eb\u3067\u3059\u3002\n\n## \u4f7f\u3044\u65b9\n```python\nimport fies\n\n# json\u30d5\u30a1\u30a4\u30eb\u4fdd\u5b58\nfies[\"./test.json\"] = {\"hoge\": 23, \"dummy_data\": \"fuga\"}\n\n# json\u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f\nprint(fies[\"./test.json\"])\t# -> {'hoge': 23, 'dummy_data': 'fuga'}\n\n# \u30d7\u30ec\u30fc\u30f3\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u66f8\u304d\u51fa\u3057\nfies[\"./test.txt\"] = \"hogehoge\"\n\n# \u30d7\u30ec\u30fc\u30f3\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f\nprint(fies[\"./test.txt\"])\t# -> hogehoge\n\n# pickle\u30d5\u30a1\u30a4\u30eb\u66f8\u304d\u51fa\u3057\nfies[\"./test.pickle\"] = [(\"hoge\", 23), 5.7]\n\n# pickle\u30d5\u30a1\u30a4\u30eb\u8aad\u307f\u8fbc\u307f\nprint(fies[\"./test.pickle\"])\t# -> [('hoge', 23), 5.7]\n\n# csv\u30d5\u30a1\u30a4\u30eb\u66f8\u304d\u51fa\u3057\nfies[\"./test.csv\"] = [\n\t[\"hoge\", \"fuga\"],\n\t[23, True],\t# \u6570\u5024\u3084\u771f\u7406\u5024\u578b\u306e\u3082\u306e\u306f\u6587\u5b57\u5217\u306b\u5909\u63db\u3055\u308c\u308b\n\t['Hey, \"Escape\" man!\\n']\t# \u6539\u884c\u3084\u30ab\u30f3\u30de\u3001\u30c0\u30d6\u30eb\u30af\u30aa\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u304c\u3042\u308b\u5834\u5408\u306f\u81ea\u52d5\u7684\u306b\u30a8\u30b9\u30b1\u30fc\u30d7\u3055\u308c\u308b\n]\n\n# yaml\u30d5\u30a1\u30a4\u30eb\u66f8\u304d\u51fa\u3057\nfies[\"./test.yml\", \"yaml\"] = {\"hoge\": {\"fuga\": 13, 77: [1,2]}}\n```\n\n## \u767a\u5c55\u7684\u306a\u4f7f\u3044\u65b9\n```python\n# \u30d0\u30a4\u30ca\u30ea\u30d5\u30a1\u30a4\u30eb\u66f8\u304d\u51fa\u3057\nfies[\"./test.bin\", \"binary\"] = b\"hoge\"\n\n# \u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u6307\u5b9a\u66f8\u304d\u51fa\u3057\nfies[\"./test.myext\", \"json\"] = {\"hoge\": 23, \"dummy_data\": \"fuga\"}\n\n# \u30d5\u30a1\u30a4\u30eb\u306e\u518d\u5e30\u7684\u5217\u6319 (\u7d76\u5bfe\u30d1\u30b9\u306e\u30ea\u30b9\u30c8\u304c\u8fd4\u308b)\nprint(fies[\"./input_dir/\"].all())\nprint(fies[\"./input_dir/\"].rec())\t# \u3053\u306e\u66f8\u304d\u65b9\u3067\u3082\u4e0a\u8a18\u3068\u540c\u69d8\n```\n\n\n",
"bugtrack_url": null,
"license": "CC0 v1.0",
"summary": "A tool to easily read and write json files, pickle files, binary files, csv files and plain text files.",
"version": "1.4.0",
"project_urls": {
"Homepage": "https://github.co.jp/"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bbae307c15ac1f284187fdc5a98a8060f4c3d87d039b161387c655cab109fc4a",
"md5": "3581b8cdc075d48d51f6b3ddf643154c",
"sha256": "258e45c7efe9f4edc8dc7116798e015058e9b8e9dd897e122da09c09ef8d59b9"
},
"downloads": -1,
"filename": "fies-1.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3581b8cdc075d48d51f6b3ddf643154c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5701,
"upload_time": "2024-02-26T04:49:46",
"upload_time_iso_8601": "2024-02-26T04:49:46.395545Z",
"url": "https://files.pythonhosted.org/packages/bb/ae/307c15ac1f284187fdc5a98a8060f4c3d87d039b161387c655cab109fc4a/fies-1.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f8703569ae3926f6e547faf1c7c510e283988e383f40b227b05cdf9e4b58f05f",
"md5": "3697d908bd353542845f1b88d9141dc4",
"sha256": "1c0e0a9f1463360a2f448b0b19413fae05df462d15a398c7a724b4a7b152e5c2"
},
"downloads": -1,
"filename": "fies-1.4.0.tar.gz",
"has_sig": false,
"md5_digest": "3697d908bd353542845f1b88d9141dc4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5389,
"upload_time": "2024-02-26T04:49:48",
"upload_time_iso_8601": "2024-02-26T04:49:48.953655Z",
"url": "https://files.pythonhosted.org/packages/f8/70/3569ae3926f6e547faf1c7c510e283988e383f40b227b05cdf9e4b58f05f/fies-1.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-26 04:49:48",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "fies"
}