Skip to main content

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.3.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

CodeConvert-2.0.3-py2.7.egg (8.2 kB view details)

Uploaded Source

File details

Details for the file CodeConvert-2.0.3.tar.gz.

File metadata

File hashes

Hashes for CodeConvert-2.0.3.tar.gz
Algorithm Hash digest
SHA256 a6d095175fd1090f018c138550cd468a5936b24f993e2ccfbb12e0ca25562d0b
MD5 29593132a72309a0fc2c7d272250d29f
BLAKE2b-256 10a73435af1b7dff196b1b1934b4e0d4a67540dffea15b07bbb647b637f2e02c

See more details on using hashes here.

File details

Details for the file CodeConvert-2.0.3-py2.7.egg.

File metadata

File hashes

Hashes for CodeConvert-2.0.3-py2.7.egg
Algorithm Hash digest
SHA256 368bed841cd26b04c2b0758bcde5e84c59bad877f14de6753644d4d2e8cee441
MD5 a3a0e9b4a515edc5bb91618345ad82bc
BLAKE2b-256 2a71f2556570e15d2f0d6b8e3cc145bc9feaeca64d6a1d3da42f42e1939519e7

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