7个习惯提高python效率

1. 使用本地变量 尽可能使用局部变量,避免使用全局变量html 2.减小函数调用 (1)当咱们判断对象的类别的时候,尽可能使用isinstance(),其次使用id(),最不济使用type()python type(num)==type(0) type(num) is type(0) isinstance(num,(int)) 每次循环都会调用len(a)函数 while i < len(a):
相关文章
相关标签/搜索