Codigo python
This commit is contained in:
parent
b9c8bea85e
commit
99365ad4d0
1 changed files with 27 additions and 0 deletions
27
gnuSnapCode.py
Normal file
27
gnuSnapCode.py
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
from pygments import highlight
|
||||||
|
from pygments.lexers import get_lexer_by_name
|
||||||
|
from pygments.formatters import ImageFormatter
|
||||||
|
from pygments.formatters.img import PilNotAvailable
|
||||||
|
|
||||||
|
lenguaje = get_lexer_by_name("python", stripall=True)
|
||||||
|
|
||||||
|
trozo_codigo = """
|
||||||
|
from pygments import highlight
|
||||||
|
from pygments.lexers import get_lexer_by_name
|
||||||
|
from pygments.formatters import ImageFormatter
|
||||||
|
from pygments.formatters.img import PilNotAvailable
|
||||||
|
|
||||||
|
lenguaje = get_lexer_by_name("python", stripall=True)
|
||||||
|
|
||||||
|
trozo_codigo = ""\"
|
||||||
|
...
|
||||||
|
...
|
||||||
|
|
||||||
|
""\"
|
||||||
|
|
||||||
|
img = highlight(trozo_codigo, lenguaje, ImageFormatter(style='material'), outfile="codigo.png")
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
img = highlight(trozo_codigo, lenguaje, ImageFormatter(style='material'), outfile="codigo.png")
|
Loading…
Reference in a new issue