🏺 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.6.0.tar.gz
(19.5 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.6.0-py3-none-any.whl
(3.6 kB
view details)
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8467bb9891bef50d51ad00809a20f99d9c7787070e9af13aed646a01c4d8c8b
|
|
| MD5 |
0a5513edb173d74126b0f3e3260068fa
|
|
| BLAKE2b-256 |
2c45cb22d89802f770ec2898d105279e6e8695fc7ea317ca42c0cf6280ac4d8e
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8c9e5cb9df3c29bc3295f3408fd812e39da99d35fa7cb21d224c56881ec4a58
|
|
| MD5 |
6bc4d10328983b5c91e3545621b8c3fd
|
|
| BLAKE2b-256 |
f790362111a21b816eeb63cf4d3b849717000521267698695ee62c1643eb82ed
|