python from pygments import highlight from pygments.lexers import PythonLexer from pygments.formatters import HtmlFormatter code = ''' def hello_world(): print("Hello, world!") ''' formatted_code = highlight(code, PythonLexer(), HtmlFormatter()) print(formatted_code) python from pygments.styles import get_all_styles all_styles = list(get_all_styles()) for style in all_styles: print(style)


上一篇:
下一篇:
切换中文