文件操作 - highlighter.py
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/doc/python3-rich/examples/highlighter.py
编辑文件内容
""" This example demonstrates a simple text highlighter. """ from rich.console import Console from rich.highlighter import RegexHighlighter from rich.theme import Theme class EmailHighlighter(RegexHighlighter): """Apply style to anything that looks like an email.""" base_style = "example." highlights = [r"(?P<email>[\w-]+@([\w-]+\.)+[\w-]+)"] theme = Theme({"example.email": "bold magenta"}) console = Console(highlighter=EmailHighlighter(), theme=theme) console.print("Send funds to money@example.org")
修改文件时间
将文件时间修改为当前时间的前一年
删除文件