摘要: 写 #覆盖写 with open(f_path,'w') as f: f.write('I love programming!\n') f.write('I love English too!\n') f.flush() #立即写入,不先写入缓存 #追加 with open(f_path,'a') 阅读全文
posted @ 2019-11-27 11:07 xd_xumaomao 阅读(200) 评论(0) 推荐(0) 编辑
摘要: In [1]: a = 5.026 In [2]: b = 5.000 In [3]: round(a,2) Out[3]: 5.03 In [4]: round(b,2) Out[4]: 5.0 In [5]: '%.2f' % a Out[5]: '5.03' In [6]: '%.2f' % 阅读全文
posted @ 2019-11-27 10:41 xd_xumaomao 阅读(8122) 评论(0) 推荐(0) 编辑