Skip to main content

Write python language in chinese

Project description

zhpy is the python on Chinese, which is good for Taiwan and China beginners to learn python in our native language.

zhpy is a lightweight python module and a source convertor, which provides a command line tool to translate python code. The python code written by traditional and simplified chinese could be translated to nature python code (english).

zhpy use pyparsing module to detect chinese keywords, class name, methods, arguments, variables and translate them back to python.

It’s possible for developers to port zhpy to python on korean or python on japenese.

Check examples here.

Install zhpy

You could use easy_install command to install zhpy:

$ easy_install zhpy

or check instructions for detail.

Usage

You could use interpretor to test zhpy with zh_exec method:

$ python
>>> from zhpy import zh_exec
>>> zh_exec("print hello") # execute zhpy here, pypi not allow non ascii code.
hello

You could use ‘zhpy’ command instead of “python” in command line to execute source code mixed in Chinese and English.:

$ zhpy hello.py
hello, world!

You could assign a file name to export the zhpy source to the normal python source (english):

$ zhpy hello.py n_hello.py

Then run the exported file as normal python source:

$ python n_hello.py
hello, world!

Or you could combine these two steps in one command (with ‘-p’ option):

$ python -p hello.py
hello, world!
$ ls
hello.py n_hello.py

check the BasicUsage for detail.

Programming

You could mix original english keywords and Chinese keywords in your zhpy source.

Reserved keywords are listed here

You could view the ChangeLog to see what’s new in these version

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

zhpy-0.5.zip (21.3 kB view details)

Uploaded Source

Built Distribution

zhpy-0.5-py2.5.egg (18.2 kB view details)

Uploaded Source

File details

Details for the file zhpy-0.5.zip.

File metadata

  • Download URL: zhpy-0.5.zip
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for zhpy-0.5.zip
Algorithm Hash digest
SHA256 cbb3f2d33ede74b116c039d1a568c45528f4169574ec18b9d5077dd7d198265b
MD5 92383f0c7c0d4120ee40336ff7aa779b
BLAKE2b-256 c337b3e45e0a4389f0db80309d6a77618eb47817dd1fd6e94988d93e3780121e

See more details on using hashes here.

File details

Details for the file zhpy-0.5-py2.5.egg.

File metadata

  • Download URL: zhpy-0.5-py2.5.egg
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for zhpy-0.5-py2.5.egg
Algorithm Hash digest
SHA256 0399505f341dd14008c78e124e7d7e469d0ffbc24eb7c4e44bfffa410072d4a7
MD5 27e28a3ddadc68f4b6d050224e581f50
BLAKE2b-256 a692a6989bb944788c6999423aec3b5f5c4f2549ad502a46a2ce6390ac790bf4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page