x=input()#输入一个字符串y=int(input())#输入指定字符串宽度print("{:}.format(x))如何在format格式化里面指定输入的宽度啊。比如指定100宽度,10宽度。我试了试在宽度那里填变量y,提示不行。
收起
可以啊,再套个花括号
x = input() y = int(input()) print("{:^{}}".format(x,y))
报告相同问题?