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

>>> print CodeConvert.Convert2Utf8(u'\xe6\x9c\x80\xe5\x90\x8e\xe4\xb8\x80\xe4\xb8\xaa\xe9\x97\xae\xe9\xa2\x98')
    最后一个问题

>>> print CodeConvert.Convert2Utf8(u'\\xe6\\x9c\\x80\\xe5\\x90\\x8e\\xe4\\xb8\\x80\\xe4\\xb8\\xaa\\xe9\\x97\\xae\\xe9\\xa2\\x98')
    最后一个问题

>>> print CodeConvert.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 CodeConvert.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 CodeConvert.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 CodeConvert.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 = CodeConvert.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 = CodeConvert.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.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

CodeConvert-2.0.1-py2.7.egg (7.1 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: CodeConvert-2.0.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for CodeConvert-2.0.1.tar.gz
Algorithm Hash digest
SHA256 31074a2e06451b1faf49b2080a61926a1ef347a4f418b2de5aba5c9d03c38b5c
MD5 8f33b952c7f6449688ec1cebde6dc973
BLAKE2b-256 1280e189a86383717622787612713f04e70724abb3ce43951b715beb235b4f07

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for CodeConvert-2.0.1-py2.7.egg
Algorithm Hash digest
SHA256 4843817137fa565a7c845b2477202014550ff59b35188fdf9bd9aa96c9483843
MD5 ac40802b2e58cf59244f3d3a83213ff3
BLAKE2b-256 0ac5654ae5a272c4ff3692f65c2c6b785b6983ff53ddfd37c115d476b8bb38f6

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