【python】 The different between ' %r ' and ' %s '

for example:

 test = """hello, world"""
 print "this is test1: %s" %test
 print "this is test2: %r" %test
输出:
   this is test1: hello,
   world
   this is test2: 'hello, world'
 
由此可见,在python中格式化字符%r,表示打印的是对象,什么都打印
原文地址:https://www.cnblogs.com/wangfangkui/p/3629141.html