Jump to content

Write language name in 3D ASCII: Difference between revisions

Add a more general Python solution
(Add a more general Python solution)
Line 2,464:
 
{{out}}
<pre> <<<<<<<<<<<<<<<> <<<> <<<> <<<<<<<<<<<<<<<> <<<> <<<> <<<<<<<<<<<<> <<<> <<<>
<pre>
<<<<<<<<<<<<<<<> <<<> <<<> <<<<<<<<<<<<<<<> <<<> <<<> <<<<<<<<<<<<> <<<> <<<>
<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<<<<> <<<>
<<<> <<<> <<<> <<<> <<<<<<<<<<<<<<<<<<> <<<> <<<> <<<> <<<> <<<>
<<<<<<<<<<<<<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<>
<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<<<<>
<<<> <<<> <<<> <<<> <<<> <<<<<<<<<<<<> <<<> <<<></pre>
</pre>
 
An otherAnother implementation:
{{lines too long|Python|name 'table' should be split at least.}}
<lang python>
Line 2,515 ⟶ 2,513:
 
{{out}}
<pre> .----------------. .----------------. .----------------. .----------------. .----------------. .-----------------.
<pre>
.----------------. .----------------. .----------------. .----------------. .----------------. .-----------------.
| .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. |
| | ______ | || | ____ ____ | || | _________ | || | ____ ____ | || | ____ | || | ____ _____ | |
Line 2,526 ⟶ 2,523:
| | | || | | || | | || | | || | | || | | |
| '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' |
'----------------' '----------------' '----------------' '----------------' '----------------' '----------------' </pre>
 
</pre>
A more general solution that scrapes http://www.network-science.de/ascii for the ascii art.
<lang python>import requests
import html
 
text = "Python"
font = "larry3d"
url = f"http://www.network-science.de/ascii/ascii.php?TEXT={text}&FONT={font}&RICH=no&FORM=left&WIDT=1000"
 
r = requests.get(url)
r.raise_for_status()
 
ascii_text = html.unescape(r.text)
pre_ascii = "<TD><PRE>"
post_ascii = "\n</PRE>"
ascii_text = ascii_text[ascii_text.index(pre_ascii) + len(pre_ascii):]
ascii_text = ascii_text[:ascii_text.index(post_ascii)]
 
print(ascii_text)</lang>
{{out}}
<pre> ____ __ __
/\ _`\ /\ \__ /\ \
\ \ \L\ \ __ __\ \ ,_\\ \ \___ ___ ___
\ \ ,__//\ \/\ \\ \ \/ \ \ _ `\ / __`\ /' _ `\
\ \ \/ \ \ \_\ \\ \ \_ \ \ \ \ \ /\ \L\ \/\ \/\ \
\ \_\ \/`____ \\ \__\ \ \_\ \_\\ \____/\ \_\ \_\
\/_/ `/___/> \\/__/ \/_/\/_/ \/___/ \/_/\/_/
/\___/
\/__/</pre>
 
=={{header|Racket}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.