Text formatting error: '=' alignment not allowed in string format specifier

前端 未结 6 1568
庸人自扰
庸人自扰 2020-12-30 19:24

What does \'=\' alignment mean in the following error message, and why does this code cause it?

>&         


        
6条回答
  •  情书的邮戳
    2020-12-30 20:04

    This format would be acceptable

    "{num}:03".format(num="1")
    

    but the way you have the placeholder specified {num:03} is not. That is an interesting ValueError though, if you remove the : the interesting error is replaced by a standard KeyError.

提交回复
热议问题