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.5.0.tar.gz (3.1 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.5.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fil-1.5.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","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.5.0.tar.gz
Algorithm Hash digest
SHA256 bfd4a7cf07a96868f18160118c2efe1f388d8aa654524130f64435ecf1bd7104
MD5 85ba0726ebeced0a07badd65459c9ef9
BLAKE2b-256 4d72d55361e2f1a93f584359a9a29e40bda9c74b2ff194b68ec864a285bf9a12

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fil-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 69c18966c44927da75ce03b77c709157cc8376329ac813e5dc2871fd7d0a2292
MD5 e55074e5f0a34626a82d2467ed552726
BLAKE2b-256 228873e912b83b9a5b98bfa558be73d64697d9fb7dcd0aa7ab867621d6f43d79

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