1. 常用命令
1.1 字符串
1 | s.rfind('l') # if s = "hello", then this expression returns 3 |
1.2 文件系统
1 | import os, sys |
1.3 格式化输出
1 | print("this is a string", flush=True) |
1.4 类型判定
1 | dataset = dataset if isinstance(dataset, (list, tuple)) else [dataset] |
1.5 循环遍历
1 | for i, (k, v) in enumerate(zip(names, values)) |
1.6 numeric
1 | sys.float_info.min # 2.2250738585072014e-308 |
1.7 文件读写
1 | with open(filename, "w") as fout: |
1.8 Error/Exception
1 | raise ValueError("The {} does not exist".format(filename)) |
1.9 系统命令调用
1 | # demo 1 |
1.10 Setup
1 | python3 setup.py install |