Skip to main content

🏺 Read/write JSON/TOML/Yaml/txt 🏺

Project description

Example 1: read a file

d1 = fil.read('file.json')   # Any Json
d2 = fil.read('file.toml')   # A dict
d3 = fil.read('file.yaml')   # Any JSON
d4 = fil.read('file.txt')    # A string

# Reading a JSON Line file returns an interator:
for record in fil.read('file.jsonl'):
    print(record)  # A sequence of JSON

Example 2: write to a file

fil.write(d1, 'file.json')  # d1 can be any JSON
fil.write(d2, 'file.toml')  # d2 must be a dict
fil.write(d3, 'file.yaml')  # d3 can be any JSON
fil.write(d4, 'file.txt')   # d4 most be a str

# Write an iterator to a JSON Line file
dicts = ({'key': i} for i in range(10))
fil.write(dicts, 'file.jsonl')

API Documentation

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

fil-1.4.3.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

fil-1.4.3-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file fil-1.4.3.tar.gz.

File metadata

  • Download URL: fil-1.4.3.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.11 Darwin/21.6.0

File hashes

Hashes for fil-1.4.3.tar.gz
Algorithm Hash digest
SHA256 7abeb2ca11334d56e79a31e60c1482d445573733a18708496d96d83903c202e9
MD5 4a7455d09d78b9152a0006c2b9de43f5
BLAKE2b-256 f827c439a008ea9fd1fab930d476e06435a6b56a91ad23e77dba2da666ea9ec1

See more details on using hashes here.

File details

Details for the file fil-1.4.3-py3-none-any.whl.

File metadata

  • Download URL: fil-1.4.3-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.11 Darwin/21.6.0

File hashes

Hashes for fil-1.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 806901c6beee6668ff9f140e013cbfbb5ce7e925b6bf2086af706419f36a7ce6
MD5 dd8406a92aea53ebf4260c8a65beb526
BLAKE2b-256 fda9d4befb27cf684c6d813fdbe87695099fa47053fe01bb8683b1a6c331411a

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