Discuss / Python / 用%运算符,为啥报错啊?

用%运算符,为啥报错啊?

Topic source

>>> ‘hi, %s, you have $%d.' % ('Cathy', 10000)

  File "<stdin>", line 1

    ‘hi, %s, you have $%d.' % ('Cathy', 10000)

      ^

SyntaxError: invalid character in identifier

Ohhhh我知道了 第一个引号打成中文模式的引号了。。


  • 1

Reply