I am trying to print the art of ascii as follows:
print(("""\ ._ o o \_`-)|_ ,"" \ ," ## | ಠ ಠ. ," ## ,-\__ `. ," / `--._;) ," ## / ," ## / """).encode('utf-8'))
And the result does not look right.
What is the correct way to print ascii art?
encodetakes a string and encodes it into bytes. This is not what you want here; you want to just print the line directly:
encode
print("""\ ._ o o \_`-)|_ ,"" \ ," ## | ಠ ಠ. ," ## ,-\__ `. ," / `--._;) ," ## / ," ## / """)
If this does not work, your terminal is most likely not configured to display Unicode. Unfortunately, I am not very good at terminal configuration; Why is my terminal not displaying unicode characters correctly? may be appropriate, but my ability to help is mostly limited on the Python side.
print(r"""\ ._ o o \_`-)|_ ,"" \ ," ## | ಠ ಠ. ," ## ,-\__ `. ," / `--._;) ," ## / ," ## / """)
r , , , .
"... " \u0ca0 " ..."
print(giraffe) - , PYTHONIOENCODING, , bash:
print(giraffe)
PYTHONIOENCODING
$ PYTHONIOENCODING=utf-8 python3 -c 'from text_art import giraffe as s; print(s)'
print(giraffe.encode('utf-8')):
print(giraffe.encode('utf-8'))
print()
sys.stdout.buffer.write(some_bytes)
''.encode('utf-8')
__header__ = '''Content-Type: application/xml \033[92m .---------------------------------. \033[92m | .---------------------------. | \033[92m |[]|\033[94m __ __ * \033[92m|[]| \033[92m | |\033[94m / | / | / \033[92m| | \033[92m | |\033[94m (___|(___|( \033[92m| | \033[92m | |\033[94m | )| | \033[92m| | \033[92m | |\033[94m | / | | \033[92m| | \033[92m | |\033[94m / | |\033[92m| | \033[92m | |\033[94m( ___ ___ ___| ___ ___|\033[92m| | \033[92m | |\033[94m| | )| )| )|___)| )\033[92m| | \033[92m | |\033[94m| |__/ |__/||__/ |__ |__/ \033[92m| | ..And more
print(__header__)
print(r"""\ ._ o o \_'-)|_ ,"" \ ," ## | ಠ ಠ. ," ## ,-\__ '. ," / '--._;) ," ## / ," ## / """) print(r"""\ ._ o o \_'-)|_ ,"" \ ," ## | ಠ ಠ. ," ## ,-\__ '. ," / '--._;) ," ## / ," ## / """)
_.' : '._ .-.''. ; .''.-. __ / : ___\ ; /___ ; \ __ ,'_ ""--.:__;".-.";: :".-.":__;.--"" _', :' '.t""--.. '<@.';_ ',@>' ..--""j.' '; ':-.._J '-.-'L__ '-- ' L_..-;' "-.__ ; .-" "-. : __.-" L ' /.------.\ ' J "-. "--" .-" __.l"-:_JL_;-";.__ .-j/'.; ;"""" / .'\"-. .' /:'. "-.: .-" .'; '. .-" / ; "-. "-..-" .-" : "-. .+"-. : : "-.__.-" ;-._ \ ; \ '.; ; : : "+. ; : ; ; ; : ; : \: ; : ; : ;: ; : : \ ; : ; : ; / :: ; ; : ; : ; : ;: : : ; : ; : : ; : ; ;\ : ; : ; ; ; ; : '."-; : ; : ; / ; ; -: ; : ; : .-" : :\ \ : ; : \.-" : ;'. \ ; : ;.'_..-- / ; : "-. "-: ; :/." .' : \ \ : ;/ __ : \ .-'.\ /t-"" ":-+. : '. .-" 'l __/ /'. : ; ; \ ; \ .-" .-"-.-" .' .'j \ / ;/ \ / .-" /. .'.' ;_:' ; :-""-.'./-.' / '.___.' \ 't ._ / bug you have "-.t-._:'
Source: https://habr.com/ru/post/1540321/More articles:Sheets map event equivalent to the Simple event in Google Map - google-mapsКаковы линии% lex и /lex в jison? - jisonJAXB throws an InstantiationException event when accessing Openendlight Northway APIs - javaGuaranteed 6-digit random number - javaGet Facebook User ID in FB PHP SDK 4.0 - facebookSpring bean not auto-negotiation with @Component annotation - javaVb script does not work in Chrome or Firefox - only in Internet Explorer - firefoxHighcharts: initializing StockChart with the new Highchart - javascriptПредварительная декларация SBCL: возможно? - sbclCordoba 3.4 FileReader not working (no onloadend) - javascriptAll Articles