_ allows you to write Python code using only _.
Project description
_
_
allows you to write Python code using only _
.
Installation
[!TIP] It is highly recommended to use a virtual environment for proper installation of the
_.pth
file.
python -m pip install underscores
Python 3.9 or a newer version is required.
Usage
The following script is a "Hello, world!" program which can be executed by the Python interpreter:
# coding: _
_ ____ _ _____ _ ____ __ _ _ ___ ______ ____ _ ____ _ ___ _ ____ __ ___ _ __ _
_____ _ _ ______ _____ _ ___ _ _ _ ___ _____ ______ _ ____ _ _ _ ____ _ _ _ ____
_ ____ _ __ __ ___ _ _ ______ ___ _ ____ __ ______ _ ____ _ ____ _ ____ __ _ _
____ _ _ _ ___ _____ _____ _ _ ______ ____ _ _ ______ _____ _ __ _ ______
You can generate a script with _
:
print('print("Hello, world!")'.encode("_").decode("utf-8"))
Troubleshooting
If you get SyntaxError: invalid syntax
, make sure the line # coding: _
is present at the top of your script.
If you get SyntaxError: encoding problem: _
, follow the steps below to make sure the _
encoding is registered on startup:
- Run
SITE_PACKAGES=$(python -c 'import sysconfig; print(sysconfig.get_path("purelib"))')
to get the path to the Python site-packages directory. - Run
echo "import underscores" > "$SITE_PACKAGES/_.pth"
to register the_
encoding on startup.
[!NOTE] If using PowerShell, use
$SITE_PACKAGES
instead ofSITE_PACKAGES
to assign the variable.
This issue is commonly encountered when installing _
into the user site-packages.
Credits
_
is a port of _
from Ruby to Python.
Please check out the original creator mame.
Big thanks to shailist for this awesome post about custom encodings.
License
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
File details
Details for the file underscores-0.0.2.tar.gz
.
File metadata
- Download URL: underscores-0.0.2.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 534eff86f99bc8edb7a69d432db178ea42e4aea8b4d6aa17774ebdfd792c5dc3 |
|
MD5 | 76ec748da65710daa1ba03fb6b4189ac |
|
BLAKE2b-256 | dccce3087a237cdeb555bcca2b3d13d7b7c4ca68c673e80905c09a944b842e94 |