python 问题>>> counter = 0>>> miles = 1000.0>>> name = 'Bob'>>> counter = counter + 1>>> kilometers = 1,609 * miles>>> print '%f miles is the same as &f km' % (miles, kilometers)Traceback (most recent call last): File "", line 1, in print '%f
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 00:36:53
python 问题>>> counter = 0>>> miles = 1000.0>>> name = 'Bob'>>> counter = counter + 1>>> kilometers = 1,609 * miles>>> print '%f miles is the same as &f km' % (miles, kilometers)Traceback (most recent call last): File "", line 1, in print '%f
python 问题
>>> counter = 0
>>> miles = 1000.0
>>> name = 'Bob'
>>> counter = counter + 1
>>> kilometers = 1,609 * miles
>>> print '%f miles is the same as &f km' % (miles, kilometers)
Traceback (most recent call last):
File "", line 1, in
print '%f miles is the same as &f km' % (miles, kilometers)
TypeError: not all arguments converted during string formatting
怎么回事?
? 有什么不同?
python 问题>>> counter = 0>>> miles = 1000.0>>> name = 'Bob'>>> counter = counter + 1>>> kilometers = 1,609 * miles>>> print '%f miles is the same as &f km' % (miles, kilometers)Traceback (most recent call last): File "", line 1, in print '%f
print '%f miles is the same as %f km' % (miles, kilometers)