Code Convert for Humans
Project description
CodeConvert is a simple code convert script(library) for Python, 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
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
CodeConvert-2.0.2.tar.gz
(4.1 kB
view details)
Built Distribution
CodeConvert-2.0.2-py2.7.egg
(8.0 kB
view details)
File details
Details for the file CodeConvert-2.0.2.tar.gz
.
File metadata
- Download URL: CodeConvert-2.0.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d7017e330190024f2d8d93e9672358e84c38452d1fdc981557032594320fa1e |
|
MD5 | 2f8b1d0fc1a3ef2f59cca4cdb3a4469e |
|
BLAKE2b-256 | 6f4422d53835b44fc30615573b8874bb85d20e7b69961a301059392f56310c0c |
File details
Details for the file CodeConvert-2.0.2-py2.7.egg
.
File metadata
- Download URL: CodeConvert-2.0.2-py2.7.egg
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35a0dcb4bd79870bf9c5a367743d9f749c3fccfc18daf8f3cf5cf74921c50c6d |
|
MD5 | d978f73e43b985cd74226de68032b8fc |
|
BLAKE2b-256 | 5ce1faa558dd0b54fee0bb5e3eab66d4a618da6e481037cbabc14d772603ef1e |