🏺 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
Release history Release notifications | RSS feed
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
fil-1.5.0-py3-none-any.whl
(3.8 kB
view details)
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfd4a7cf07a96868f18160118c2efe1f388d8aa654524130f64435ecf1bd7104
|
|
| MD5 |
85ba0726ebeced0a07badd65459c9ef9
|
|
| BLAKE2b-256 |
4d72d55361e2f1a93f584359a9a29e40bda9c74b2ff194b68ec864a285bf9a12
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69c18966c44927da75ce03b77c709157cc8376329ac813e5dc2871fd7d0a2292
|
|
| MD5 |
e55074e5f0a34626a82d2467ed552726
|
|
| BLAKE2b-256 |
228873e912b83b9a5b98bfa558be73d64697d9fb7dcd0aa7ab867621d6f43d79
|