simple-fstring
A simple basic f-string like behavior in Python 2
Installation
$ pip install simple-fstring
Usage
from fstring import f
a = 1
b = 2
c = u"哈哈"
d = "哈哈"
print f("${a + b}") # 3
print f(u"我是c${c}") # 我是c哈哈
print f("我是d${d}") # 我是d哈哈
print f("我是d${c}c") # 鎴戞槸d哈哈c
print f(u"我是c${d}d") # 我是c鍝堝搱d
print f("$${}") # ${}
print f("${{'a':'dict test'\}.get('a')}") # dict test
print f("${{'a':'dict test'}.get('a')}") # {'a':'dict test'.get('a')}
# specify expr namespace
print f("${a + b}", globals_ns={"a": 10, "b": 20}, locals_ns={"a": 1}) # 21
License
Release files for simple-fstring 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| simple-fstring-0.1.tar.gz | 2.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simple_fstring-0.1-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 5.5 kB
Release files / simple-fstring-0.1.tar.gz
| Download URL | simple-fstring-0.1.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2925ed2b3dae1ca25d8fac0c25c04064c7c7e824da37d07e279c7608265d05d
|
|
BLAKE2b-256 checksum How to use checksums |
3328b0efc8fbb0f79387c22c38a53c61675d732c7e260ae25b5245131757bce5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/44.1.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.18
|
Release files / simple_fstring-0.1-py2-none-any.whl
| Download URL | simple_fstring-0.1-py2-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
a04bd904551c9903f0779c61e55ec376539721e1fffbec75392a40dfc62363b3
|
|
BLAKE2b-256 checksum How to use checksums |
dc829a34f00a78807941a9f36691d6a26a5778d2ceace2da41736e4514a3b27f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/44.1.1 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.18
|