python中%r和%s的区别
来源:互联网 发布:淘宝秒杀有人抢到了吗 编辑:程序博客网 时间:2024/04/27 13:22
%r用rper()方法处理对象
%s用str()方法处理对象
有些情况下,两者处理的结果是一样的,比如说处理int型对象。
例一:
返回结果:
另外一些情况两者就不同了
例二:
返回结果:
再看一种情况
例三:
可见,%r打印时能够重现它所代表的对象(rper() unambiguously recreate the object it represents)
参考:http://stackoverflow.com/questions/6005159/when-to-use-r-instead-of-s-in-python
0 0
- python中%r和%s的区别
- python中%s和%r的区别
- python中%r和%s的区别
- python中%r和%s的区别
- python中%r和%s的区别
- python中%r和%s的区别
- python中%r和%s的区别
- Python中%r和%s的区别
- python中%r和%s的区别
- python中%s与%r的区别
- Python %s和%r的区别
- python %r 和%s的区别
- Python %r%s的区别
- python中%s和%r
- python学习笔记1:%r和%s的区别
- python 基础 —— "%s" 与 "%r" 的区别
- Python和R语言的区别
- python %s and %r and %d 区别
- mysql显示报错“Got error 28 from storage engine”
- Unit 1-Lecture 5:Quantifiers & Predicate Logic
- 记录一些常用的易忘(偏门)的控件属性
- shiro权限框架学习——简单概念和使用
- linux作业(1)
- python中%r和%s的区别
- Struts2、Spring、Mbatis中输出日志log4j.properties文件的配置
- 微信小程序:短期不可高估,长期不可低估
- Linux的基础命令
- 深度学习之caffe的BN层
- Qt使用QuaZip对文件进行压缩解压操作
- 蓝牙解析(part10):BLE ATT/GATT
- win7应用程序图标显示不正常
- Linux如何删除非空文件夹