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.6.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: fil-1.6.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for fil-1.6.0.tar.gz
Algorithm Hash digest
SHA256 b8467bb9891bef50d51ad00809a20f99d9c7787070e9af13aed646a01c4d8c8b
MD5 0a5513edb173d74126b0f3e3260068fa
BLAKE2b-256 2c45cb22d89802f770ec2898d105279e6e8695fc7ea317ca42c0cf6280ac4d8e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fil-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for fil-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d8c9e5cb9df3c29bc3295f3408fd812e39da99d35fa7cb21d224c56881ec4a58
MD5 6bc4d10328983b5c91e3545621b8c3fd
BLAKE2b-256 f790362111a21b816eeb63cf4d3b849717000521267698695ee62c1643eb82ed

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