time模块 import time print(help(time)) time.time() #return current time in seconds since the Epoch as a float 时间戳:以秒的形式返回当前时间,从1970年算起 time.clock() #return CPU time since process start as a float 只计算CPU执行的时间 time.sleep() # delay for a number of second…
collections collections是Python数据类型的补充,可以实现Counter计数.可命名元组(namedtuple).默认字典.有序字典.双向队列等功能 参考:http://python.usyiyi.cn/python_278/library/collections.html Help on module collections: NAME collections FILE c:\python27\lib\collections.py CLASSES __builtin_…
参考链接:老师 BLOG : http://www.cnblogs.com/wupeiqi/articles/4906230.html 入门拾遗 一.作用域 只要变量在内存中就能被调用!但是(函数的栈有点区别) 对于变量的作用域,执行声明并在内存中存在,如果变量在内存中存在就可以被调用. if 1==1: name = 'tianshuai' print name 所以下面的说法是不对的: 外层变量,可以被内层变量使用 内层变量,无法被外层变量使用 二.三元运算 result = 值1 if 条…
一.作用域 对于变量的作用域,执行声明并在内存中存在,该变量就可以在下面的代码中使用. if 1==1: name = 'lenliu' print name 下面的结论对吗?(对) 外层变量,可以被内层变量使用 内层变量,无法被外层变量使用 二.三元运算 result = 值1 if 条件 else 值2 result = 'lenliu' if 1 == 1 else 'amy'print result 如果条件为真:result = 值1如果条件为假:result = 值2 三.进制 二进…