Skip to content

moskytw/uniout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Uniout

It makes Python print the object representation in readable chars instead of the escaped string.

Example

>>> from pprint import pprint >>> langs = [ ... 'Hello, world!', ... '你好,世界!', ... 'こんにちは世界', ... u'Hello, world!', ... u'你好,世界!', ... u'こんにちは世界' ... ] ...

Before:

>>> pprint(langs) ['Hello, world!', 'xe4xbdxa0xe5xa5xbdxefxbcx8cxe4xb8x96xe7x95x8cxefxbcx81', 'xe3x81x93xe3x82x93xe3x81xabxe3x81xa1xe3x81xafxe4xb8x96xe7x95x8c', u'Hello, world!', u'u4f60u597duff0cu4e16u754cuff01', u'u3053u3093u306bu3061u306fu4e16u754c']

After:

>>> import uniout >>> pprint(langs) ['Hello, world!', '你好,世界!', 'こんにちは世界', u'Hello, world!', u'你好,世界!', u'こんにちは世界']

Installation

You can install it via PyPI,

sudo pip install uniout

or download it manually.

Changelog

v0.3.7

  1. Switch to long-string syntax (''' or """) automatically.

v0.3.6

  1. Fixed the issue with empty string.

v0.3.5

  1. Make it still works for files.

v0.3.4

  1. A better fix for the previous bug.

v0.3.3

  1. Fixed the problem that Uniout can't be installed by PIP.

v0.3.2

  1. Show the original string if the escaped string can't be decoded properly.
  2. Use better way to find string literals.
  3. Print more correct unescaped string representation.

v0.3.1

  1. Fixed a bug when Uniout works with IPython.

v0.3

Thanks for the pull requests #3 and #4 from @timtan, it now

  1. works well with IPython,
  2. and also supports stderr.

About

Never see escaped bytes in output.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages