2
这里是我的代码,并且错误信息:错误信息的内置功能
>>> message = ‘The price of this {0:s} laptop I {1:d} USD and the exchange rate is {2:4.2f} USD to 1 EUR’.format(‘Apple’, 1299, 1.23342342)
SyntaxError: invalid character in identifier
据我正在关注的书,我的代码是正确的。我应该提到,“The”这个词以粉红色突出显示,“and”“是”两个词都显示为黄色。
看起来您正在使用错误的引号。使用''''或'''字符引用你的字符串。 – Craig
谢谢,是的,你说得对! – TJE