Commit a39acbc0 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

add Message.preview()

parent f15ab7e7
...@@ -289,6 +289,13 @@ class Message: ...@@ -289,6 +289,13 @@ class Message:
for d in dlist: for d in dlist:
f.write(self.dict2msg(d) + "\n") f.write(self.dict2msg(d) + "\n")
def preview(self, dlist: list[dict]) -> str:
"""Preview messages."""
s = ""
for d in dlist:
s += self.dict2msg(d) + "\n"
print(s)
@staticmethod @staticmethod
def dict2msg(d: dict): def dict2msg(d: dict):
"""Convert `dict` to JSON format string.""" """Convert `dict` to JSON format string."""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment