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/11/23 03:05:25
python问题>>>counter=0>>>miles=1000.0>>>name=''Bob''>>>counter=counter+1>>>kilometers=1,609*miles>>>prin

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)