Python 'f' Codec
Project description
Python f Codec
Wrap lonesome f-strings in print().
How to install
> python3 -m pip install f-codec
Why?
# -*- coding: f -*-
def dictionary(inst, depth=0):
ಠ_ಠ = ' ' * depth
f''' {{
'''
for name, val in inst.items():
if isinstance(val, dict):
f'''
{name} =
''' > ಠ_ಠ
dictionary(val, depth + 1)
else:
f'''
{name} = {val},
''' > ಠ_ಠ
f'''
}}
''' > ಠ_ಠ
decl = {
'a': 1,
'b': 2,
'c': { 'a': 3, 'b': 4 },
'd': { 'a': 5, 'b': { 'a': 6, 'b': 7 }, 'c': 8 },
'e': 9
}
f'''
decl =
'''
dictionary(decl)
> python3 test.py
decl = {
a = 1,
b = 2,
c = {
a = 3,
b = 4,
}
d = {
a = 5,
b = {
a = 6,
b = 7,
}
c = 8,
}
e = 9,
}
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
f-codec-0.1.0.tar.gz
(3.2 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
File details
Details for the file f-codec-0.1.0.tar.gz.
File metadata
- Download URL: f-codec-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a095126ed3a527c9d9623b21c7362ed3b3453f947601044f292928a44103ed65
|
|
| MD5 |
17153ded1f11d9c0b8a2f9e64495804c
|
|
| BLAKE2b-256 |
222000f9839e7e16bfa42fdf0204a379ff1ebbc9dc38c775f9888ce3d353d412
|
File details
Details for the file f_codec-0.1.0-py3-none-any.whl.
File metadata
- Download URL: f_codec-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b46ce03fb0da48d24098a22cd9c465b20fb41bd57c03acdb41aed5a67974028
|
|
| MD5 |
94870f4f7932eaa9918c4bb07d13c621
|
|
| BLAKE2b-256 |
d6ddc09fdbd174fa4bab1c53a38505a61315f2149c623c9ed4ecd53eff03d7d2
|