”{:}“里应是整型的对象,None不行的,语法错误。
多尝试几次,你可以试着改变format()里的参数(应该也是错误,我试了)"{:x}".format(80)
'50'
"{:None}".format(80)
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
"{:None}".format(80)
ValueError: Invalid format specifier 'None' for object of type 'int'
"{:None}".format(80.0)
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
"{:None}".format(80.0)
ValueError: Invalid format specifier 'None' for object of type 'float'
"{:None}".format()
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
"{:None}".format()
IndexError: Replacement index 0 out of range for positional args tuple
"{:None}".format( )
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
"{:None}".format( )
IndexError: Replacement index 0 out of range for positional args tuple
失败是成功他妈![](static/image/smiley/ARU/aru-1x-1_011.png) ![](static/image/smiley/ARU/aru-1x-1_037.png) |