摘要: #字符串的相关操作 #基本操作 #+ 字符串连接操作 str1 = '来是come走是go' str2 = '点头yes摇头no' result = str1 + str2 print(result) #* 字符串复制操作 str1 = '天地不仁以万物为刍狗' result = str1 * 3 print(result) #[] 索引操作 str1 = '柳暗花明又一村' prin... 阅读全文
posted @ 2017-11-12 23:18 Sun阳 阅读(309) 评论(0) 推荐(0) 编辑
摘要: #数学相关的函数 #导入数学的模块 import math #floor()向下取整 result = math.floor(6.2) print(result) #ceil()向上取整 result = math.ceil(5.5) print(result) #round()四舍五入 注意:不是math中的函数,系统自带 #n.5 当n为奇数会入,为偶数则舍 result = roun... 阅读全文
posted @ 2017-11-12 23:09 Sun阳 阅读(1372) 评论(0) 推荐(0) 编辑