打赏

星辰大海ゞ

That which does not kill us makes us stronger!

导航

2015年5月21日 #

repr() 和 str() 函数

摘要: Python 有办法将任意值转为字符串:将它传入repr() 或str() 函数。函数str() 用于将值转化为适于人阅读的形式,而repr() 转化为供解释器读取的形式(如果没有等价的语法,则会发生SyntaxError 异常) 某对象没有适于人阅读的解释形式的话, str() 会返回与repr(... 阅读全文

posted @ 2015-05-21 15:57 星辰大海ゞ 阅读(395) 评论(0) 推荐(0) 编辑

Python格式化输出

摘要: python print格式化输出1. 打印字符串print ("His name is %s"%("Aviad"))效果:2.打印整数print ("He is %d years old"%(25))效果:3.打印浮点数print ("His height is %f m"%(1.83))效果:4... 阅读全文

posted @ 2015-05-21 15:34 星辰大海ゞ 阅读(328) 评论(0) 推荐(0) 编辑