CodeConvert is a simple code convert script(library) for Python 2.x, built for human beings.
You can call function Convert2Utf8 or Convert2Unicode to exec code convert. Or just call function Convert2Utf8_test or Convert2Unicode_test to get code convert’s step.
CodeConvert support convert basestring(str or unicode)/tuple/list/dict/set.
Installation
pip install CodeConvert
Usage
>>> from CodeConvert import CodeConvert as cc
>>> print cc.Convert2Utf8(u'\xe6\x9c\x80\xe5\x90\x8e\xe4\xb8\x80\xe4\xb8\xaa\xe9\x97\xae\xe9\xa2\x98')
最后一个问题
>>> print cc.Convert2Utf8(u'\\xe6\\x9c\\x80\\xe5\\x90\\x8e\\xe4\\xb8\\x80\\xe4\\xb8\\xaa\\xe9\\x97\\xae\\xe9\\xa2\\x98')
最后一个问题
>>> print cc.Convert2Utf8({'cc': u'\\xe6\\x9c\\x80\\xe5\\x90\\x8e\\xe4\\xb8\\x80\\xe4\\xb8\\xaa\\xe9\\x97\\xae\\xe9\\xa2\\x98'})
{'cc': '\xe6\x9c\x80\xe5\x90\x8e\xe4\xb8\x80\xe4\xb8\xaa\xe9\x97\xae\xe9\xa2\x98'}
>>> print cc.Convert2Utf8(['cc', u'\\xe6\\x9c\\x80\\xe5\\x90\\x8e\\xe4\\xb8\\x80\\xe4\\xb8\\xaa\\xe9\\x97\\xae\\xe9\\xa2\\x98'])
['cc', '\xe6\x9c\x80\xe5\x90\x8e\xe4\xb8\x80\xe4\xb8\xaa\xe9\x97\xae\xe9\xa2\x98']
>>> print cc.Convert2Utf8(('cc', u'\\xe6\\x9c\\x80\\xe5\\x90\\x8e\\xe4\\xb8\\x80\\xe4\\xb8\\xaa\\xe9\\x97\\xae\\xe9\\xa2\\x98'))
('cc', '\xe6\x9c\x80\xe5\x90\x8e\xe4\xb8\x80\xe4\xb8\xaa\xe9\x97\xae\xe9\xa2\x98')
>>> print cc.Convert2Utf8(set(('cc', u'\\xe6\\x9c\\x80\\xe5\\x90\\x8e\\xe4\\xb8\\x80\\xe4\\xb8\\xaa\\xe9\\x97\\xae\\xe9\\xa2\\x98')))
set(['cc', '\xe6\x9c\x80\xe5\x90\x8e\xe4\xb8\x80\xe4\xb8\xaa\xe9\x97\xae\xe9\xa2\x98'])
>>> cc = cc.Convert2Utf8_test(u'\xe6\x9c\x80\xe5\x90\x8e\xe4\xb8\x80\xe4\xb8\xaa\xe9\x97\xae\xe9\xa2\x98')
>>> u 内含 utf8 编码: obj.encode('raw_unicode_escape')
>>> cc = cc.Convert2Utf8_test(u'\\xe6\\x9c\\x80\\xe5\\x90\\x8e\\xe4\\xb8\\x80\\xe4\\xb8\\xaa\\xe9\\x97\\xae\\xe9\\xa2\\x98')
>>> 双反斜杠字符: obj.decode('string_escape')
>>> utf8 编码: obj
Release files for CodeConvert 3.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| CodeConvert-3.0.2.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| CodeConvert-3.0.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 6.4 kB
Release files / CodeConvert-3.0.2.tar.gz
| Download URL | CodeConvert-3.0.2.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ad903964834a3a47d56eb58d58477b52cc746532932baedd99497f3f6e39edf
|
|
BLAKE2b-256 checksum How to use checksums |
9ce452aa2bd91ef8e3e4a3754d80a53745c07b175dbb7b2d5bd6ddeca34da4fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/18.5 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.10
|
Release files / CodeConvert-3.0.2-py2.py3-none-any.whl
| Download URL | CodeConvert-3.0.2-py2.py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
0b4f95b155ee1d83ead77fe87cb3da45ec9168470ca4013a7c2c0ef442e9f77e
|
|
BLAKE2b-256 checksum How to use checksums |
32a95837578ade55e603548f641d445a17df1a78ed49d666e244650b6b573cff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/18.5 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.10
|