摘要: 一、分类:%格式符方式,format方式 二、%格式符 1、%s——字符占位,%d——数字占位(十进制) 2、左对齐、右对齐 (1)+ 右对齐 (2)- 左对齐 三、format方式 1、对齐方式 (1)> 内容左对齐 (2)> 内容右对齐(默认) (3)^ 内容居中 2、常见格式化方法 阅读全文
posted @ 2018-09-13 11:03 澄心元素 阅读(177) 评论(0) 推荐(0) 编辑
摘要: while True: pass while 1: pass #效果相同,后者 效果更快 s = 1 y = bool (s) #结果为True,int只要不是0,就为真 s = 'abc' y = bool (s) #结果为True,str型有数值,就为真 s while s : pass #可以直接判断,这样引用,s直接是空数据,为False 阅读全文
posted @ 2018-09-13 10:58 澄心元素 阅读(5206) 评论(0) 推荐(0) 编辑
摘要: print(0 and 2 > 1) #结果0 print(0 and 2 1) #结果True print(1 and 2 1 and 0) #结果0 print(2 1 and 1) #结果1 print(2 1) #结果True print(0 or 2 1) #结果1 print(1 or 2 1 or 0) #结果True print(2 1 or 1) #结果Tru... 阅读全文
posted @ 2018-09-13 10:26 澄心元素 阅读(295) 评论(0) 推荐(0) 编辑