Skip to content

Commit

Permalink
美化表格 v3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Zkeq committed Feb 15, 2022
1 parent 8aad833 commit a401e5d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python-CLI/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import time
import hashlib
from prettytable import PrettyTable
import textwrap
from prettytable import DOUBLE_BORDER
import urllib.parse


# 读取json文件
Expand Down Expand Up @@ -116,9 +119,13 @@ def hash_loop():


def print_table(data_json):
table = PrettyTable(['编号', '短链', '长链'])
table = PrettyTable(['编号', '短链', '长链 (经过解码后的)(请 全屏查阅 本表格)'])
_keys = list(data_json.keys())
_values = list(data_json.values())
for i in range(len(_values)):
_values[i] = urllib.parse.unquote(_values[i])
_values[i] = textwrap.fill(_values[i], width=70)
table.set_style(DOUBLE_BORDER)
for i in range(len(_keys)):
table.add_row([i+1, 'https://tuo.icodeq.com/' + _keys[i], _values[i]])
print(table)
Expand Down

1 comment on commit a401e5d

@vercel
Copy link

@vercel vercel bot commented on a401e5d Feb 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

Please sign in to comment.