#Combine %r with double-quote and single-quote escapes and print them out.
#Compare %r with %s. Notice how %r prints it the way you'd write it in your file,
#but %s prints it the way you'd like to see it?
这是我为练习写的:
1) mybugs1 = "Guido said: %r and moved on." %'I \'love\' \"my\" bugs'
2) mybugs2 = "Stallman said: %s and moved on." % 'I \'love\' \"my\" bugs'
3) print mybugs1
4) print mybugs2
输出
Guido said: 'I \'love\' "my" bugs' and moved on.
Stallman said: I 'love' "my" bugs and moved on.
问题
%r 不会像我在 .py 文件中那样打印所有内容(例如,它在第 1 行打印“my”而不是“my”)。为什么?