Skip to main content

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, YAML 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.
]

# Save YAML file
fies["./test.yml", "yaml"] = {"hoge": {"fuga": 13, 77: [1,2]}}

Advanced usage

# Save binary file
fies["./test.bin", "binary"] = b"hoge"

# format-specified save
fies["./test.myext", "json"] = {"hoge": 23, "dummy_data": "fuga"}

概要

  • jsonファイル, YAMLファイル, 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']	# 改行やカンマ、ダブルクオーテーションがある場合は自動的にエスケープされる
]

# yamlファイル書き出し
fies["./test.yml", "yaml"] = {"hoge": {"fuga": 13, 77: [1,2]}}

発展的な使い方

# バイナリファイル書き出し
fies["./test.bin", "binary"] = b"hoge"

# フォーマット指定書き出し
fies["./test.myext", "json"] = {"hoge": 23, "dummy_data": "fuga"}

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

fies-1.2.3.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fies-1.2.3-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file fies-1.2.3.tar.gz.

File metadata

  • Download URL: fies-1.2.3.tar.gz
  • Upload date:
  • Size: 5.1 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

Hashes for fies-1.2.3.tar.gz
Algorithm Hash digest
SHA256 9496bf8d6ba801a919b2762a88274b9d76f0c212f271fe42cc2f075e458c5d2f
MD5 da7b094a99c331acd81803e87f1befd6
BLAKE2b-256 6011ec0059fec8b6f4edbfff52bd35b35bc6d00b45ed12f1fe0d161931d308d9

See more details on using hashes here.

File details

Details for the file fies-1.2.3-py3-none-any.whl.

File metadata

  • Download URL: fies-1.2.3-py3-none-any.whl
  • Upload date:
  • Size: 6.1 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

Hashes for fies-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a9dac33bdfbdf8673d26aa0a42d644c39df9bb9c5e73bfc0e0b21b29601adbf9
MD5 cca12d76fa9758e1f9274b4bf7145f16
BLAKE2b-256 d885770270038e177bf14b0961cea0fca12884a6fcf410362000d70e68fba57a

See more details on using hashes here.

Supported by

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