摘要: 集合 set集合,是一个无序且不重复的元素集合 s=set(['alex','alex','sb'])print(s) >>>{'sb', 'alex'} s=set('hello') print(s) >>>{'o', 'l', 'h', 'e'} 几种方法 函数 def func1(x, *ar 阅读全文
posted @ 2019-04-08 22:56 坚持fighting 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 一、字符串格式化 #打印浮点数 (%f指的是浮点数,%后加.2保留两位小数)tpl = "percent %.2f" % 99.976234444444444444print(tpl) >>>percent 99.98 #打印百分比( %%表示“%”)tpl = 'percent %.2f %%' 阅读全文
posted @ 2019-04-08 22:11 坚持fighting 阅读(232) 评论(0) 推荐(0) 编辑