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, level=0):
indent = ' ' * level
f''' {{
''' > indent
for name, val in inst.items():
if isinstance(val, dict):
f'''
{name} =
''' > indent
dictionary(val, level + 1)
else:
f'''
{name} = {val},
''' > indent
f'''
}}
''' > indent
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.0.5.tar.gz
(2.9 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.0.5.tar.gz.
File metadata
- Download URL: f-codec-0.0.5.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
661891f52b67aebf21d71310cbd026f31e15d87267c14c0e40e25e6ef2194a2f
|
|
| MD5 |
2faa51669a4a9c2eaacd6159a3c974af
|
|
| BLAKE2b-256 |
6d87de471aadc3d38d6a6d7496ad25322afcc0faceb7d988dc77ca4a6321c5d9
|
File details
Details for the file f_codec-0.0.5-py3-none-any.whl.
File metadata
- Download URL: f_codec-0.0.5-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed237b0dacd76ed25f037061bfc18b47b54a40abaeb973c295c540db638bf0ff
|
|
| MD5 |
eef9b12c91422bfaceaea5081a102a66
|
|
| BLAKE2b-256 |
e8b5723ae8108d25fb7d3e17d08170df479e1007e0c1d63f6c953321dfdfea2c
|