31 lines
1.2 KiB
Diff
31 lines
1.2 KiB
Diff
|
|
From 7f124327e8954bbcda68c2832f20b1d0d7a4808b Mon Sep 17 00:00:00 2001
|
||
|
|
From: kiraskyler <80014218+kiraskyler@users.noreply.github.com>
|
||
|
|
Date: Sat, 1 Mar 2025 23:35:22 +0800
|
||
|
|
Subject: [PATCH] Fix encode during show(stdout=True) (#230)
|
||
|
|
|
||
|
|
Co-authored-by: niuwanli <niuwanli@cqsoftware.com.cn>
|
||
|
|
---
|
||
|
|
treelib/tree.py | 3 ++-
|
||
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/treelib/tree.py b/treelib/tree.py
|
||
|
|
index e27200f..b16baa4 100644
|
||
|
|
--- a/treelib/tree.py
|
||
|
|
+++ b/treelib/tree.py
|
||
|
|
@@ -948,6 +948,7 @@ def show(
|
||
|
|
:param reverse: the ``reverse`` param for sorting :class:`Node` objects in the same level.
|
||
|
|
:param line_type:
|
||
|
|
:param data_property: the property on the node data object to be printed.
|
||
|
|
+ :param stdout: if True print it, if False return printing.
|
||
|
|
:param sorting: if True perform node sorting, if False return
|
||
|
|
nodes in original insertion order. In latter case @key and
|
||
|
|
@reverse parameters are ignored.
|
||
|
|
@@ -975,7 +976,7 @@ def write(line):
|
||
|
|
print("Tree is empty")
|
||
|
|
|
||
|
|
if stdout:
|
||
|
|
- print(self._reader.encode("utf-8"))
|
||
|
|
+ print(self._reader)
|
||
|
|
else:
|
||
|
|
return self._reader
|