GithubHelp home page GithubHelp logo

uniout's Introduction

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!',
 '\xe4\xbd\xa0\xe5\xa5\xbd\xef\xbc\x8c\xe4\xb8\x96\xe7\x95\x8c\xef\xbc\x81',
 '\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf\xe4\xb8\x96\xe7\x95\x8c',
 u'Hello, world!',
 u'\u4f60\u597d\uff0c\u4e16\u754c\uff01',
 u'\u3053\u3093\u306b\u3061\u306f\u4e16\u754c']

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.

uniout's People

Contributors

moskytw avatar timtan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.