Cats萌萌
s意义是字符串r意义是使用repr,而不是str%r 用来做 debug 比较好,因为它会显示变量的原始数据(raw data),而其它的符号则是用来向用户显示输出的。在《笨办法学习Python(第三版)》中有详细说明比如>>> print '%s, %s'%('one', 'two')
one, two
>>> print '%r, %r'%('one', 'two')'one', 'two'个人习惯还是喜欢用format方法