Skip to main content

Code Convert for Humans for Python 2.x

Project description

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

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

Uploaded Source

Built Distribution

CodeConvert-2.0.4-py2-none-any.whl (5.2 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for CodeConvert-2.0.4.tar.gz
Algorithm Hash digest
SHA256 74050265a2ba56c43e3b67a3cf11ce72891984666aa8b4cfcdadf1178cc55dc5
MD5 c3716bf4d521c82792050d124f48156c
BLAKE2b-256 15aeec54826a8a3ac10119d88fd178adec16d412084dfe4e9f812f230fef54f9

See more details on using hashes here.

File details

Details for the file CodeConvert-2.0.4-py2-none-any.whl.

File metadata

File hashes

Hashes for CodeConvert-2.0.4-py2-none-any.whl
Algorithm Hash digest
SHA256 062d0844959bf1321c3a5011f5f5042913a44d36097f017e157482e0dfc0846a
MD5 97a06d509eab36281851c82bc8fb84ee
BLAKE2b-256 d577850f47d54be6069a1d56a800cd25fe1741c73973b0034ba807ba17a26856

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