Python the Hard Way - exercise 6 - %r versus %s

前端 未结 7 750
孤城傲影
孤城傲影 2020-12-04 17:35

http://learnpythonthehardway.org/book/ex6.html

Zed seems to use %r and %s interchangeably here, is there any difference between the two? Wh

7条回答
  •  被撕碎了的回忆
    2020-12-04 18:27

    The code below illustrates the difference. Same value prints differently:

    x = "xxx"
    withR = "prints with quotes %r"
    withS = "prints without quotes %s"
    

提交回复
热议问题