Python 为什么我会犯这个错误?类型错误:';列表';对象不能解释为整数

Python 为什么我会犯这个错误?类型错误:';列表';对象不能解释为整数,python,string,Python,String,我的代码中出现以下错误我做错了什么: Traceback (most recent call last): File "Solution.py", line 15, in <module> print_formatted(n) File "Solution.py", line 9, in print_formatted print(d.ljust([2,' ']),o.ljust([2,' ']),h.ljust([2,' ']),b.ljust([2,' '

我的代码中出现以下错误我做错了什么:

Traceback (most recent call last):
  File "Solution.py", line 15, in <module>
    print_formatted(n)
  File "Solution.py", line 9, in print_formatted
    print(d.ljust([2,' ']),o.ljust([2,' ']),h.ljust([2,' ']),b.ljust([2,' ']))
TypeError: 'list' object cannot be interpreted as an integer

    TypeError: 'list' object cannot be interpreted as an integer

ljust
接受两个参数,而不是两个元素的列表。使用以下命令:

print(d.ljust(2, ' '), o.ljust(2, ' '), h.ljust(2, ' '), b.ljust(2, ' '))

请将其降低并提高到预期值。显示中间结果与您期望的结果之间的偏差。您能解释一下您的期望吗?向我们展示一个输入和输出示例。
print(d.ljust(2, ' '), o.ljust(2, ' '), h.ljust(2, ' '), b.ljust(2, ' '))