Skip to main content

To read and write files.

Project description

IOutil

PyPI Pypi - License PyPI - Python Version

To read and write files.

csv, json, parquet, text, toml formats is supported.

Installation

pip install -U ioutil

Usage

usage: ioutil [options]

optional arguments:
  -h, --help      show this help message and exit
  -v, --version   show version number and exit.

to read/write files:
  path            path to read/write
  -r, --read      to read file
  -w, --write     to write file
  -d, --data      data to write
  -f, --format    file format to use
  -m, --mode      mode to open file
  --rfv           will return formatted string (CSV only)

-w/--write function may return error as it expects data in specific datatype.
Writing files using commandline isn't recommended.

Python Script

To read/write csv file.

from ioutil import csv

data = [['a', 'b'], [1, 2], [3, 4]]
path = '.../file.csv'
csv.write(data=data, path=path)  # to write csv
csv.read(path=path)  # to read csv
from ioutil import File

data = [{'a': 1, 'b': 2}, {'a': 3, 'b': 4}]
path = '.../file.csv'

File.write(data=data, path=path)  # to write file
File.read(path=path)  # to read file

Command Line (not recommended)

To write a text file.

$ ioutil ".../file.txt" --data "data" --write
True

To read a json file.

$ ioutil ".../file.json" --read
### content of a file ###

Issues:

If you encounter any problems, please file an issue along with a detailed description.

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

ioutil-1.0.3.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

ioutil-1.0.3-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file ioutil-1.0.3.tar.gz.

File metadata

  • Download URL: ioutil-1.0.3.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for ioutil-1.0.3.tar.gz
Algorithm Hash digest
SHA256 871e1edad0a7edfd757517d32832650dd5f44d872fe14a1b6f56e4c55fc589fe
MD5 93bc84d9351db412df6ac8ff3626ecbe
BLAKE2b-256 0b8cae81cbb66af64b662b7ceedf6130846b28c0ddde808ff844ff25a9025932

See more details on using hashes here.

File details

Details for the file ioutil-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: ioutil-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for ioutil-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4a9740abc586f9a8de0fc7106a0d2c9002640afca946b24587add67674da8822
MD5 ced169c824892e4fe87c035abf9415ee
BLAKE2b-256 9936357e61faf8c26584bc7203afad8fc09ca26a98ffd825ff6519fe81871d1f

See more details on using hashes here.

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