|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
代码如下:
"{:None}".format(80)
Traceback (most recent call last):
File "<pyshell#20>", line 1, in <module>
"{:None}".format(80)
ValueError: Invalid format specifier 'None' for object of type 'int'
”{:}“里应是整型的对象,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
复制代码
失败是成功他妈  
|
|