![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
文章平均质量分 63
erhuabushuo
这个作者很懒,什么都没留下…
展开
-
区分出两个浮点数最小区别
sys.float_info.epsilon def is_float_equal(a, b): return abs(a - b)原创 2012-04-26 13:34:51 · 1019 阅读 · 0 评论 -
命名元组 collections.namedtuple
>>> import collections >>> Sale = collections.namedtuple("Sale", "productid customerid date quantity price") >>> sales1 = Sale(1,1,'2012-01-01', 100, 100) >>> print("{date}".format(**sales1._asdi原创 2012-04-27 11:36:05 · 291 阅读 · 0 评论 -
str.format
{field_name!conversion:format_specification} 字段名 ... 转换 s 强制使用字符串形式 r 强制使用表象形式 a 强制使用表象形式,但仅限于ASCII字符 格式规范 : fill align sign # 0 width , . precision原创 2012-04-26 20:03:38 · 244 阅读 · 0 评论