caesar0301 / treelib

An efficient implementation of tree data structure in python 2/3.
http://treelib.readthedocs.io/en/latest/
Other
802 stars 185 forks source link

How to display tree properly? #46

Closed vmirly closed 7 years ago

vmirly commented 9 years ago

Hi, I have started using treelib and I like it very much! However, I cannot display the tree properly in python 3.4, for example I get this b'Harry' b'\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Bill' b'\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Jane' b' \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Diane' b' \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Mary' b' \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Mark'

instead of this on python 2.7

Harry ├── Bill └── Jane ├── Diane │ └── Mary └── Mark

Is there anyway to fix this?

Natim commented 9 years ago

Yes you should print unicode rather than bytes.

Holi0317 commented 8 years ago

Commit 08dc67b has fixed this issue, but treelib did not update after this commit.

As this bug is an serious bug for python3, @caesar0301, would you like to make a release for this?

caesar0301 commented 8 years ago

Sorry for late feedback. I was away for my vacation. I have published a latest minor version 1.3.3 to pypi. Otherwise you can install the github repo version to get new features in future. :)