我試圖獲得以下工作在Python解釋器中,但它給了我一個錯誤,我似乎無法找到我的錯誤在哪裏? (我是一個蟒蛇新手)Python .format - 錯誤
>>> print 'THe value of PI is approx {}.'.format(math.pi)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'format'
任何想法?
你使用的是什麼python版本? – fabrizioM 2010-08-15 14:47:16