I want to print a staircase like pattern using .format() method. I tried this,
for i in range(6, 0, -1):
print("{0:>"+str(i)+"}".format("#"))
但它给我带来了以下错误:
ValueError: Single } encountered in format string
基本想法是印刷
#
#
#
#
#
#
具有类似准则的
for i in range(6, 0, -1):
print("{0:>i}".format("#"))