我对python很陌生,把它当作一种爱好兴趣,并通过一些搜索发现自己是一堆来自" 计算实践 " 的练习,其中一个要求写一个ASCII数字,如下所示.

这一切似乎都是一个足够简单的练习,但我似乎无法用一个数字来描绘这个,练习说明上面的绘图是通过使用数字"1"绘制的.
它还指出,不能或不应使用0或100以上的数字来创建ASCII绘图.
这是另一个例子:
这里的输入是数字"2".

我找到了一种方法来显示第一个图像,但不是通过任何方式使用给定的数字,只是在while循环中的一个简单的"else",所以我可以过滤掉低于或等于0的数字并且高于或等于100.
我已经死了.
我的代码如上所述,不使用变量编号来创建第一个图:
while True:
s = input("Give me a number to make a drawing with that is between 0 and 100: ")
if not s.isdigit():
print ("Error, only numbers will make this program run.")
continue #Try Again but with a number this time
if int(s) >= 100:
print ("The number is bigger than or equal to 100 and won't work. \nDo try again.")
continue #try again
if int(s) <= 0: …Run Code Online (Sandbox Code Playgroud) 我想在我们的开发人员的命令行工具中添加一个复活节彩蛋,如果匹配某个日期,它将向用户致意.基本上,我正在寻找:
>>> print big_text("Happy\nBirthday")
. _________ _...._ _________ _...._
.'| \ |.' '-. \ |.' '-. .-. .-
< | \ .'```'. '.\ .'```'. '.\ \ / /
| | __ \ | \ \\ | \ \\ \ / /
| | .'''-. .:--.'. | | | | | | | | \ \ / /
| |/.'''. \ / | \ | | \ / . | \ / . \ \ / /
| / | | …Run Code Online (Sandbox Code Playgroud) 既然python有办法做几乎所有我想知道的是有任何API可以帮助我打印出真正花哨的文本到我的日志,例如
# # ####### # # ##########
# # # # # # #
# # # # # # #
##### #### # # # #
# # # # # # #
# # # # # # #
# # ####### ######## ######## ##########
Run Code Online (Sandbox Code Playgroud)
我试过pprint,其中没有任何东西像这样.
有小费吗?谢谢
我正在编写一个库,该库将在连接到 Raspberry Pi 的 LED 矩阵上打印滚动文本。
我想要一个函数,它接受一个字符、高度和宽度并生成一个矩阵,其中包含应该设置的像素以表示指定的字符。
例如
def char_to_pixels(char, height, width):
matrix = [width][height]
# determine which pixels to set based on character supplied
...
return matrix
Run Code Online (Sandbox Code Playgroud)
因此,对于char_to_pixels('I', 6, 6)您的呼叫,您可能需要一个如下所示的矩阵:
|0|1|1|1|1|0|
|0|0|1|1|0|0|
|0|0|1|1|0|0|
|0|0|1|1|0|0|
|0|0|1|1|0|0|
|0|1|1|1|1|0|
Run Code Online (Sandbox Code Playgroud)
我可以尝试为 [AZ] 定义每一个,但我想知道是否有一个图书馆已经做了这种事情?