22 初始模块 random time collections functools
一 .初始模块
1.从⼩到⼤的顺序: ⼀条代码 < 语句块 < 代码块(函数, 类) < 模块
2.引入模块的方式
① import 模块
② from 模块 import 功能

二. random模块

三 time 模块
1.时间戳 从1970-01-01 00:00:00 开始以 秒 计算
东八区 从1970-01-01 08:00:00
time.time() 用于时间存储

2.格式化



3.结构化(python的时间)

4 转化
①

②

四. collections 模块
1.counter (可迭代对象) 计数
每一个元素出现的次数
获取到的结果可以像字典⼀样进⾏使⽤
2.defaultdict( lambda:0) 默认值字典
3.OrderedDict( ) 将字典有序化
4.数据结构( 栈 队列)
①栈: 先进后出


②队列: 先进先出

③双向

5.namedtuple 命名元组
类似创建一个类
面向对象:

命名元组:

五.functools 模块
1.wraps (装饰器中) 可以改变一个函数的名字 ,注释

2.reduce 归纳

3.partial 偏函数 固定函数中的参数
新函数 = (旧参数,固定值)

22 初始模块 random time collections functools的更多相关文章
- python --- 22 初始模块 random time collections functools
一 .初始模块 1.从⼩到⼤的顺序: ⼀条代码 < 语句块 < 代码块(函数, 类) < 模块 2.引入模块的方式 ① import 模块 ② from 模块 im ...
- python time模块 sys模块 collections模块 random模块 os模块 序列化 datetime模块
一 collections模块 collections模块在内置的数据类型,比如:int.str.list.dict等基础之上额外提供了几种数据类型. 参考博客 http://www.pythoner ...
- oldboy edu python full stack s22 day16 模块 random time datetime os sys hashlib collections
今日内容笔记和代码: https://github.com/libo-sober/LearnPython/tree/master/day13 昨日内容回顾 自定义模块 模块的两种执行方式 __name ...
- python 全栈开发,Day27(复习, defaultdict,Counter,时间模块,random模块,sys模块)
一.复习 看下面一段代码,假如运行结果有问题,那么就需要在每一步计算时,打印一下结果 b = 1 c = 2 d = 3 a = b+c print(a) e = a + d print(e) 执行输 ...
- python之lambda,random,timeit,collections,
python之lambda,random,timeit,collections,一. python之lambda函数lambda函数又称为匿名函数,匿名函数就是没有函数名的函数.>>> ...
- python-Day5-深入正则表达式--冒泡排序-时间复杂度 --常用模块学习:自定义模块--random模块:随机验证码--time & datetime模块
正则表达式 语法: mport re #导入模块名 p = re.compile("^[0-9]") #生成要匹配的正则对象 , ^代表从开头匹配,[0 ...
- 【转】python模块分析之collections(六)
[转]python模块分析之collections(六) collections是Python内建的一个集合模块,提供了许多有用的集合类. 系列文章 python模块分析之random(一) pyth ...
- Python3模块-random、hashlib和base64
random模块 random.random()用于生成一个浮点数x,范围为0 =< x < 1 import random >>>print(random.random ...
- Python模块02/序列化/os模块/sys模块/haslib加密/collections
Python模块02/序列化/os模块/sys模块/haslib加密/collections 内容大纲 1.序列化 2.os模块 3.sys模块 4.haslib加密 5.collections 1. ...
随机推荐
- 通过 onclick = "test()"事件定义的事件 , 如何触发.
<div onclick="test()" id="xxx">点击</div> function test() { alert('123 ...
- maven搭建ssh项目及遇到的问题
如果采用手动添加jar包的方式搭建项目,会使效率降低,传到github上时,下载时需要下载很多jar包,用maven管理项目可以提高效率 我在搭建maven项目时遇到了 1) java.lang.No ...
- vue框架搭建
1到网上下载node.js,安装,(新版node,包括了npm ).2下载Git安装.3.你需要的地方建一个文件夹.打开cmd,跳转到这个文件夹输入npm install -g vue-cli 完成 ...
- POJ 1065 Wooden Sticks (贪心)
There is a pile of n wooden sticks. The length and weight of each stick are known in advance. The st ...
- 【转载】 996,谁的ICU?
原文地址: https://baijiahao.baidu.com/s?id=1629803937354992525&wfr=spider&for=pc --------------- ...
- NOI-1.1-10-字符表示超级玛丽
10:超级玛丽游戏 总时间限制: 1000ms 内存限制: 65536kB 描述 超级玛丽是一个非常经典的游戏.请你用字符画的形式输出超级玛丽中的一个场景. 输入 无. 输出 如样例所示. 样 ...
- NOI-1.1-06-空格分隔输出-体验多个输入输出
06:空格分隔输出 总时间限制: 1000ms 内存限制: 65536kB 描述 读入一个字符,一个整数,一个单精度浮点数,一个双精度浮点数,然后按顺序输出它们,并且要求在他们之间用一个空格分隔. ...
- upstream timed out (110: Connection timed out) while reading response header from upstream
Nginx报错日志有如下内容: upstream timed out (110: Connection timed out) while reading response header from up ...
- base标签对svg的影响
页面地址:http://127.0.0.1:8080/fullLink_node.html?project_id=2 base:<base href="http://127.0.0.1 ...
- 2017-2018-1 20155208 课堂测试(ch06)(补做)
2017-2018-1 20155208 课堂测试(ch06)(补做) 1.( 多选题 | 1 分) 下面说法正确的是(ABC) A . 存储层次结构中最小的缓存是寄存器 B . 存储层次结构的中心思 ...