-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (27 loc) · 806 Bytes
/
Copy pathmain.py
File metadata and controls
37 lines (27 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# pip install rich
from rich import print
from rich.console import Console
from rich.table import Table
from rich.progress import track
from rich.markdown import Markdown
import time
# 基本打印
print("Hello, [bold magenta]World[/bold magenta]!", ":vampire:", locals())
# 控制台输出
console = Console()
console.print("Hello", "World!", style="bold red")
# 表格渲染
console = Console()
table = Table(show_header=True, header_style="bold magenta")
table.add_column("Date", style="dim", width=12)
table.add_column("Title")
# ... 此处省略其他列和行的添加
console.print(table)
# 进度条
for step in track(range(100)):
# todo do_step(step)
time.sleep(1)
# Markdown
with open("README.md") as readme:
markdown = Markdown(readme.read())
console.print(markdown)