Write language name in 3D ASCII: Difference between revisions
Content added Content deleted
(Add a more general Python solution) |
|||
Line 2,464: | Line 2,464: | ||
{{out}} |
{{out}} |
||
⚫ | |||
<pre> |
|||
⚫ | |||
<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<<<<> <<<> |
<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<<<<> <<<> |
||
<<<> <<<> <<<> <<<> <<<<<<<<<<<<<<<<<<> <<<> <<<> <<<> <<<> <<<> |
<<<> <<<> <<<> <<<> <<<<<<<<<<<<<<<<<<> <<<> <<<> <<<> <<<> <<<> |
||
<<<<<<<<<<<<<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> |
<<<<<<<<<<<<<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> |
||
<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<<<<> |
<<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<> <<<<<<> |
||
<<<> <<<> <<<> <<<> <<<> <<<<<<<<<<<<> <<<> <<<> |
<<<> <<<> <<<> <<<> <<<> <<<<<<<<<<<<> <<<> <<<></pre> |
||
</pre> |
|||
Another implementation: |
|||
{{lines too long|Python|name 'table' should be split at least.}} |
{{lines too long|Python|name 'table' should be split at least.}} |
||
<lang python> |
<lang python> |
||
Line 2,515: | Line 2,513: | ||
{{out}} |
{{out}} |
||
⚫ | |||
<pre> |
|||
⚫ | |||
| .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. | |
| .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. | |
||
| | ______ | || | ____ ____ | || | _________ | || | ____ ____ | || | ____ | || | ____ _____ | | |
| | ______ | || | ____ ____ | || | _________ | || | ____ ____ | || | ____ | || | ____ _____ | | |
||
Line 2,526: | Line 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}}== |
=={{header|Racket}}== |