提问人:Ian Keh 提问时间:8/31/2023 最后编辑:MatthiasIan Keh 更新时间:8/31/2023 访问量:23
即使我要求它不要这样做,代码也会中断
The codes will breakline eventhough i asked it not to
问:
from datetime import date
now = date.today()
today_date = ' _____ _ _ ___ _____ _ _ \n |_ _|__ __| |__ _ _ _ __( )___ | \ __ |_ _|__ (_)__(_)\n | |/ _ \/ _` / _` | || (_-</(_-< | |) / _` || |/ -_) | (_-<_ \n |_|\___/\__,_\__,_|\_, /__/ /__/ |___/\__,_||_|\___| |_/__(_)\n |__/ '
one = ' _ \n / |\n | |\n |_| '
two = ' ___ \n |_ )\n / / \n /___|'
three = ' ____\n |__ /\n |_ \ \n |___/'
four = ' _ _ \n | | | \n |_ _|\n |_| '
five = ' ___ \n | __|\n |__ \ \n |___/'
six = ' __ \n / / \n / _ \ \n \___/'
seven = ' ____ \n |__ |\n / / \n /_/ '
eight = ' ___ \n ( _ )\n / _ \ \n \___/'
nine = ' ___ \n / _ \ \n \_, / \n /_/ '
zero = ' __ \n / \ \n | () |\n \__/ '
dt_string = now.strftime("%d%m")
print("date and time =", dt_string)
if dt_string[0] == 0:
print(zero)
elif dt_string[0] == '1':
print(one)
elif dt_string[0] == '2':
print(two)
elif dt_string[0] == '3':
print(three)
elif dt_string[0] == '4':
print(four)
elif dt_string[0] == '5':
print(five)
elif dt_string[0] == '6':
print(six)
elif dt_string[0] == '7':
print(seven)
elif dt_string[0] == '8':
print(eight)
elif dt_string[0] == '9':
print(nine)
if dt_string[1] == '0':
print(zero)
elif dt_string[1] == '1':
print(one)
elif dt_string[1] == '2':
print(two)
elif dt_string[1] == '3':
print(three)
elif dt_string[1] == '4':
print(four)
elif dt_string[1] == '5':
print(five)
elif dt_string[1] == '6':
print(six)
elif dt_string[1] == '7':
print(seven)
elif dt_string[1] == '8':
print(eight)
elif dt_string[1] == '9':
print(nine)
它只是一个简单的日期时间日历,我希望它打印日/月......但这个角色会突破......
我试过print(one, end=''),但它仍然不起作用
我觉得这是因为我使用的是 ascii 字符。
*这也是为了比赛,只允许使用时间库:(
答: 暂无答案
评论
sep=""
end=""
matrix = [[' '] * width] * height
←
↑
→
↓
if dt_string[0] == 0:
if dt_string[0] == '0':