Python in Hindi
Project description
python_hindi
python_hindi is a Python library (with command-line utilities) for programming Python in Hindi. (Haan, Bhai possible hai!)
python_hindi runs in Python 3.6+
After downloading this library, you can write a script like:
# if-else
sankhya = poornank(niwesh("Ek sankhya daalein: "))
yadi (sankhya % 2) == 0:
bol("{0} sam hai".format(sankhya))
anyatha:
bol("{0} visam hai".format(sankhya))
# while loop
num = 0
jabtak num < 10:
num += 1
yadi (num % 2) == 0:
jaari
bol(num)
#for loop
languages = ['Swift', 'Python', 'Go', 'JavaScript']
pratyek language mein languages:
bol(language)
Name the file kuchbhi.pyhi
and run it with pyhi kuchbhi.pyhi
.
You can also import other .pyhi
and .py
files from the main file:
aayat kuchbhi
Installing
To install with pip, type in the terminal:
and for non-errors support :
pip install python-hindi
This will create the command-line script: pyhi
Usage
You can run pyhi files with pyhi <file>
You can start the Hindi Python console with just pyhi
Example:
pyhi file.pyhi
.pyhi
file syntax
.pyhi
file supports Hindi Python syntax (syntax with keywords like aayat
(import)
and functions like bol
(print))
in addition to normal Python syntax.
Use from normal Python file/repl
You can use it as a library:
To import .pyhi
files into your .py
file:
from python_hindi import create_hook
create_hook(run_module=False, console=False) # without running the main module or starting the repl
import pyhi_module # now you can import .pyhi files
Or to start the REPL from the normal REPL:
from python_hindi import create_hook
create_hook(run_module=True, console=True) # *with* starting the repl
jupyter/ipython
python-hindi
supports jupyter and ipython interactive console by IPython extension. To use:
Install Jupyter Notebook by: pip install notebook
Start Jupyter Notebook by: jupyter notebook
.
Then create a new Python 3 by the new button.
In the first cell, enter the text %load_ext python_hindi
and press Ctrl + Enter
.
Now you can write Hindi Python in the entire notebook.
Dependencies
python-hindi depends on the Python libraries:
-
friendly - for more friendly Hinglish(hindi in roman script) traceback
-
ideas - most of this library is built on this project. It supports easy creation of import hooks and it has a simple example for replacing keywords with French keywords
-
[rich] - rich is a Python library for rich text and beautiful formatting in the terminal.
Contribute
For all errors, problems, or suggestions, please open a GitHub issue
Author
Karan Singh
License
This project is licensed under the BSD-4 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
Built Distribution
Hashes for python_hindi-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77ad7e22cca1e7f519f4a177a13007a4b8b09361f97ab77f2e421f678871ae45 |
|
MD5 | a6f580a1a09b40287b9fbb0e8b242a7e |
|
BLAKE2b-256 | 180eb948e54d897112ba9745e54a2e5f127170a657fc007bd509f84df2846b7e |