代码的格式化
In [5]: print("{:10.5f}".format(1.234567890))
1.23457
列表生成式
>>> [x if x % 2 == 0 else -x for x in range(1, 11)]
[-1, 2, -3, 4, -5, 6, -7, 8, -9, 10]
读写文件
读
lines = open(file, 'r', encoding='utf-8').readlines()
写
open("OK_" + file, 'w', encoding='utf-8').writelines(ok_lines)