首页 > 代码库 > Python 模块
Python 模块
目录
-
- 1 时间模块time
- 1.1 时间戳
- 1.2 结构化时间
- 1.3 格式化的时间
- 1.4 三种时间形式的转换
- 1.4.1 时间戳转换结构化时间
- 1.4.2 结构化时间转 时间戳
- 1.4.2 格式化字符串时间转换成结构化时间
- 1.4.4 结构化时间转化成格式化时间
- 2 random模块
- 3 hashlib 模块
- 3.1 MD5
- 3.2 SH1、SH…
- 3.2 加盐 slat
- 4 os模块
- 5 sys模块
- 1 时间模块time
模块就是py文件
注意文件的命名不能和模块的名字相同,正则在寻找的时候首先从当前路径寻找,然后从内置查找
1 时间模块time
Python中有三种表示时间的方法:
1.时间戳
- 时间戳timestap(浮点型数字):(计算机)
time.time()
1970年1月1日的是0
2.元组(struct time)结构化时间
- 结构化时间:(操作时间)
>>> time.localtime() # 默认放的是time.time()
time.struct_time(tm_year=2017, tm_mon=4, tm_mday=26, tm_hour=9, tm_min=15, tm_se
c=53, tm_wday=2, tm_yday=116, tm_isdst=0)
>>>
c=time.localtime()
拿到时间:
c.tm_year
3.格式化的时间字符串
- 格式化的时间字符串:(给人看)
time.strftime()
>>> time.strftime("%Y-%m-%d")
‘2017-04-26‘
>>> time.strftime("%Y-%m-%d %X")
‘2017-04-26 09:13:02‘
字符串时间和时间戳是不能直接转换的,通过结构化时间转换
1.1 时间戳
通常来说,时间戳表示的是从1970年1月1日00:00:00开始按秒计算的偏移量。我们运行“type(time.time())”,返回的是float类型。
import time
print(time.time())
1.2 结构化时间
struct_time元组共有9个元素共九个元素:(年,月,日,时,分,秒,一年中第几周,一年中第几天等
print(time.localtime())
结果:
time.struct_time(tm_year=2017, tm_mon=4, tm_mday=26, tm_hour=16, tm_min=0, tm_sec=5, tm_wday=2, tm_yday=116, tm_isdst=0)
1.3 格式化的时间
格式化的时间需要参数,可以用help查看
print(time.strftime(‘%Y-%m-%d %X‘))
使用help(time.strftime)
%Y Year with century as a decimal number.
%m Month as a decimal number [01,12].
%d Day of the month as a decimal number [01,31].
%H Hour (24-hour clock) as a decimal number [00,23].
%M Minute as a decimal number [00,59].
%S Second as a decimal number [00,61].
%z Time zone offset from UTC.
%a Locale‘s abbreviated weekday name.
%A Locale‘s full weekday name.
%b Locale‘s abbreviated month name.
%B Locale‘s full month name.
%c Locale‘s appropriate date and time representation.
%I Hour (12-hour clock) as a decimal number [01,12].
%p Locale‘s equivalent of either AM or PM.
1.4 三种时间形式的转换
1.4.1 时间戳转换结构化时间
import time
print(time.localtime(time.time())) # 时间戳--》结构化时间 现在是当前时间
print(time.localtime(time.time()+86400)) # 明天的时间
print(time.gmtime(time.time())) # 这是标准时间
1.4.2 结构化时间转 时间戳
print(time.mktime(time.localtime()))
1.4.2 格式化字符串时间转换成结构化时间
import time
res=time.strftime(‘%Y-%m-%d %X‘,time.localtime())
print(time.strptime(res,‘%Y-%m-%d %X‘)) # string format
先获取格式化的时间,赋值给res,res作为参数 后面是格式
1.4.4 结构化时间转化成格式化时间
print(time.strftime(‘%Y-%m-%d %X‘,time.localtime()))
print(time.strftime(‘%Y-%m-%d %X‘)) #time.localtime() 是默认放上的
2 random模块
random.random() # 0-1的浮点型数字
random.randint(1,4) # [1-4] 取整数
random.randrange(1,4) #[1-4) #没有4 顾头不顾尾
random.choice([11,44,55]) # 从这里面中随机取
random.sample([11,44,55],2) # 从这里面中随机取 参数2是取两个
random.uniform(1,3) # 定义范围的浮点数
random.shuffle([11,22,33]) # 重新打乱
item=[1,2,3,4]
print(random.shuffle(item))
print(item)
生成验证码:
需求是生成5位的验证码,是随机的字母数字,字母有大写小写
分析:关键是通过chr能够把数字转换成相应的字母,这里用的是ASCII码表的知识
import random
def Verification():
s=‘‘ # 新建一个字符串用于拼接
for i in range(5): # 生成5位数的验证码
rnum = random.randint(0,9) # 随机生成0-9的数字
rL = chr(random.randint(65,90)) # 大写字母 关键是chr能够把数字转化成ASCII
rl = chr(random.randint(97,122)) # 小写字母
res = random.choice([rnum,rL,rl]) # 从列表中随机取
s+=str(res) #把数字强制转换成str,循环追加字符串中
return s
print(Verification())
ASCII维基百科
3 hashlib 模块
把任意长度的数据转换成固定长度的数据(通常用16进制的字符串表示)
严格来说,这个并不是加密,加密的是能够解密的,hash是通过算法把数据转换,例如密码保存在数据库中是MD5,用户输入密码后,会把密码用md5转换,用转换后的和数据库中的比对
摘要算法:MD5 SHA…
3.1 MD5
ftp传文件的时候可以通过吧文件的每一行进行update
import hashlib # 导入hashlib模块
a=hashlib.md5() # 拿到的是内存地址
a.update(‘hello‘.encode(‘utf-8‘))
print(a.hexdigest()) # 打印的是hello的MD5值
a.update(‘hello‘.encode(‘utf-8‘))
print(a.hexdigest()) # 此时就是hellohello进行的转换
b=hashlib.md5() # 重新定义一个对象n
b.update(‘hellohello‘.encode(‘utf-8‘))
print(a.hexdigest()) #此时打印的值是一样的
结果:
5d41402abc4b2a76b9719d911017c592
23b431acfeb41e15d466d75de822307c
23b431acfeb41e15d466d75de822307c
3.2 SH1、SH…
调用的方法是一样的,只是名字不一样
import hashlib
m=hashlib.md5()
m.update(‘hello‘.encode(‘utf-8‘)) #
print(m.hexdigest())
n=hashlib.sha1()
n.update(‘hello‘.encode(‘utf-8‘))
print(n.hexdigest()) # sha1的用法
结果:位数不一样
5d41402abc4b2a76b9719d911017c592
aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
3.2 加盐 slat
加盐的应用,适用于系统添加固定的字符强化加密
import hashlib
a = hashlib.md5(‘hello‘.encode(‘utf-8‘)) # 加盐slat
a.update(‘hello‘.encode(‘utf-8‘))
print(a.hexdigest())
b=hashlib.md5() # 重新定义一个b
b.update(‘hellohello‘.encode(‘utf-8‘)) # 测试加盐是加在了前面
print(b.hexdigest())
4 os模块
os模块是与操作系统交互的接口
记住功能
1.os.getcwd() 当前绝对路径
2.os.chdir(r’绝对路径’) 切换目录
3.os.curdir 返回当前目录 就是.
4.os.pardir ..
5.os.makedirs(“aaa/bbb”) 在当前目录生成多层递归
6.os.removedirs(‘aaa’) 如果目录为空,则删除
7.os.rmdir()
8.os.listdir(r””) 就是ls功能 把当前的路径下的所有的内容
9.os.rename(“old,new”)
10.os.stat(r””) 文件信息 返回的是文件的结构化信息(文件大小、访问时间、)
11.os.sep win是\,linux是/
12.os.linesep 行终止符号 win是\t\n linux — \n
13.os.pathsep 文件路径拼接 win; linux
14.os.name win — nt linux— posix 可以判断平台
15.os.system(“dir”) # 类似bash 可以输入ls cd
16.os.path.abspath(“test.txt”) basepath+filename
17.os.dirname(“test.txt”) 文件路径
18.os.bsename(“test.txt”) 文件名
19.os.path.exits()
20.isabs
21.isdir
22.os.path.join(s1,s2)路径的拼接 在不同的平台的情况能够自动
23.os.getatime(path)
24.os.getmtime(path)
25.os.getsize(path) 获取文件的大小
import os
print(os.getcwd()) 获得当前的绝对路径
print(os.getcwd())
os.chdir(r"D:\Python_fullstack_s4\32") # 相当于cd命令
print(os.getcwd()) # 此时查看就是改变的路径
结果:
D:\Python_fullstack_s4\33
D:\Python_fullstack_s4\32
print(os.curdir) # 返回当前目录 就是.
print(os.pardir) # 获取当前目录的父目录字符串 ..
结果:
.
..
os.makedirs("aaaa/bbb") # 递归生成多层目录
os.removedirs("aaaa/bbb") # 删除这个目录
os.rename(‘aaa‘,‘bbb‘) # 把文件aaa重命名成bbb
res=os.stat(‘D:\Python_fullstack_s4\day33/bbb‘)
print(res)
结果:
os.stat_result(st_mode=33206, st_ino=1970324837071832, st_dev=374768, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1493205622, st_mtime=1493205622, st_ctime=1493205622)
os.mkdir(‘123‘) # 生成单级目录;相当于shell中mkdir dirname
os.rmdir(‘123‘) # 删除单级空目录,若目录不为空则无法删除,报错;相当于shell中rmdir dirname
os.remove(r‘D:\Python_fullstack_s4\day33\bbb‘) # 删除文件
print(os.name)
```结果 win---nt
linux---posix
```python
os.system(‘dir‘) #里面是命令
print(os.path.abspath(‘test.txt‘)) #返回path规范化的绝对路径
abs=os.path.abspath(‘test.txt‘)
print(os.path.basename(abs))
print(os.path.dirname(abs))
test.txt
D:\Python_fullstack_s4\day33
print(os.path.exists(‘test.txt‘) ) # 判断文件是否存在
print(os.path.isabs(‘test.txt‘)) #判断是否是绝对路径
print(os.path.isdir(‘aa‘)) # 判断是否存在目录
s1=r"C:\Users\Administrator\PycharmProjects"
s2=r"py_fullstack_s4\day33"
#print(s1+os.sep+s2)
ret=os.path.join(s1,s2) # 推荐方式
print(ret)
‘‘‘
os.getcwd() 获取当前工作目录,即当前python脚本工作的目录路径
os.chdir("dirname") 改变当前脚本工作目录;相当于shell下cd
os.curdir 返回当前目录: (‘.‘)
os.pardir 获取当前目录的父目录字符串名:(‘..‘)
os.makedirs(‘dirname1/dirname2‘) 可生成多层递归目录
os.removedirs(‘dirname1‘) 若目录为空,则删除,并递归到上一级目录,如若也为空,则删除,依此类推
os.mkdir(‘dirname‘) 生成单级目录;相当于shell中mkdir dirname
os.rmdir(‘dirname‘) 删除单级空目录,若目录不为空则无法删除,报错;相当于shell中rmdir dirname
os.listdir(‘dirname‘) 列出指定目录下的所有文件和子目录,包括隐藏文件,并以列表方式打印
os.remove() 删除一个文件
os.rename("oldname","newname") 重命名文件/目录
os.stat(‘path/filename‘) 获取文件/目录信息
os.sep 输出操作系统特定的路径分隔符,win下为"\\",Linux下为"/"
os.linesep 输出当前平台使用的行终止符,win下为"\t\n",Linux下为"\n"
os.pathsep 输出用于分割文件路径的字符串 win下为;,Linux下为:
os.name 输出字符串指示当前使用平台。win->‘nt‘; Linux->‘posix‘
os.system("bash command") 运行shell命令,直接显示
os.environ 获取系统环境变量
os.path.abspath(path) 返回path规范化的绝对路径
os.path.split(path) 将path分割成目录和文件名二元组返回
os.path.dirname(path) 返回path的目录。其实就是os.path.split(path)的第一个元素
os.path.basename(path) 返回path最后的文件名。如何path以/或\结尾,那么就会返回空值。即os.path.split(path)的第二个元素
os.path.exists(path) 如果path存在,返回True;如果path不存在,返回False
os.path.isabs(path) 如果path是绝对路径,返回True
os.path.isfile(path) 如果path是一个存在的文件,返回True。否则返回False
os.path.isdir(path) 如果path是一个存在的目录,则返回True。否则返回False
os.path.join(path1[, path2[, ...]]) 将多个路径组合后返回,第一个绝对路径之前的参数将被忽略
os.path.getatime(path) 返回path所指向的文件或者目录的最后存取时间
os.path.getmtime(path) 返回path所指向的文件或者目录的最后修改时间
os.path.getsize(path) 返回path的大小
‘‘‘
5 sys模块
sys是与解释器有关的
1.sys.exit() 程序退出
2.sys.version Python版本
3.sys.platform 返回操作系统的平台
4.sys.argv 程序执行前输入参数,返回值是一个列表 可以去到
5.sys.path sys的寻找路径的优先级 大一点的程序是在不同的目录中的、模块化
sys.argv 命令行参数List,第一个元素是程序本身路径
sys.exit(n) 退出程序,正常退出时exit(0)
sys.version 获取Python解释程序的版本信息
sys.maxint 最大的Int值
sys.path 返回模块的搜索路径,初始化时使用PYTHONPATH环境变量的值
sys.platform 返回操作系统平台名称
<style>div.oembedall-githubrepos { border: 1px solid #DDD; list-style-type: none; margin: 0 0 10px; padding: 8px 10px 0; font: 13.34px/1.4 helvetica, arial, freesans, clean, sans-serif; width: 452px; background-color: #fff } div.oembedall-githubrepos .oembedall-body { background: -webkit-gradient(linear,left top,left bottom,from(#FAFAFA),to(#EFEFEF)); border-top: 1px solid #EEE; margin-left: -10px; margin-top: 8px; padding: 5px 10px; width: 100% } div.oembedall-githubrepos h3 { font-size: 14px; margin: 0; padding-left: 18px; white-space: nowrap } div.oembedall-githubrepos p.oembedall-description { color: #444; font-size: 12px; margin: 0 0 3px } div.oembedall-githubrepos p.oembedall-updated-at { color: #888; font-size: 11px; margin: 0 } div.oembedall-githubrepos ul.oembedall-repo-stats { border: none; float: right; font-size: 11px; font-weight: 700; padding-left: 15px; position: relative; z-index: 5; margin: 0 } div.oembedall-githubrepos ul.oembedall-repo-stats li { border: none; color: #666; display: inline-block; list-style-type: none; margin: 0 !important } div.oembedall-githubrepos ul.oembedall-repo-stats li a { background-color: transparent; border: none; color: #666 !important; background-position: 5px -2px; background-repeat: no-repeat; border-left: 1px solid #DDD; display: inline-block; height: 21px; line-height: 21px; padding: 0 5px 0 23px } div.oembedall-githubrepos ul.oembedall-repo-stats li:first-child a { border-left: medium none; margin-right: -3px } div.oembedall-githubrepos ul.oembedall-repo-stats li a:hover { background: 5px -27px no-repeat #4183C4; color: #FFF !important; text-decoration: none } div.oembedall-githubrepos ul.oembedall-repo-stats li:first-child a:hover { } ul.oembedall-repo-stats li:last-child a:hover { } span.oembedall-closehide { background-color: #aaa; cursor: pointer; margin-right: 3px } div.oembedall-container { margin-top: 5px; text-align: left } .oembedall-ljuser { font-weight: 700 } .oembedall-ljuser img { vertical-align: bottom; border: 0; padding-right: 1px } .oembedall-stoqembed { border-bottom: 1px dotted #999; float: left; overflow: hidden; width: 730px; line-height: 1; background: #FFF; color: #000; font-family: Arial, Liberation Sans, DejaVu Sans, sans-serif; font-size: 80%; text-align: left; margin: 0; padding: 0 } .oembedall-stoqembed a { color: #07C; text-decoration: none; margin: 0; padding: 0 } .oembedall-stoqembed a:hover { text-decoration: underline } .oembedall-stoqembed a:visited { color: #4A6B82 } .oembedall-stoqembed h3 { font-family: Trebuchet MS, Liberation Sans, DejaVu Sans, sans-serif; font-size: 130%; font-weight: 700; margin: 0; padding: 0 } .oembedall-stoqembed .oembedall-reputation-score { color: #444; font-size: 120%; font-weight: 700; margin-right: 2px } .oembedall-stoqembed .oembedall-user-info { height: 35px; width: 185px } .oembedall-stoqembed .oembedall-user-info .oembedall-user-gravatar32 { float: left; height: 32px; width: 32px } .oembedall-stoqembed .oembedall-user-info .oembedall-user-details { float: left; margin-left: 5px; overflow: hidden; white-space: nowrap; width: 145px } .oembedall-stoqembed .oembedall-question-hyperlink { font-weight: 700 } .oembedall-stoqembed .oembedall-stats { background: #EEE; margin: 0 0 0 7px; padding: 4px 7px 6px; width: 58px } .oembedall-stoqembed .oembedall-statscontainer { float: left; margin-right: 8px; width: 86px } .oembedall-stoqembed .oembedall-votes { color: #555; padding: 0 0 7px; text-align: center } .oembedall-stoqembed .oembedall-vote-count-post { font-size: 240%; color: #808185; display: block; font-weight: 700 } .oembedall-stoqembed .oembedall-views { color: #999; padding-top: 4px; text-align: center } .oembedall-stoqembed .oembedall-status { margin-top: -3px; padding: 4px 0; text-align: center; background: #75845C; color: #FFF } .oembedall-stoqembed .oembedall-status strong { color: #FFF; display: block; font-size: 140% } .oembedall-stoqembed .oembedall-summary { float: left; width: 635px } .oembedall-stoqembed .oembedall-excerpt { line-height: 1.2; margin: 0; padding: 0 0 5px } .oembedall-stoqembed .oembedall-tags { float: left; line-height: 18px } .oembedall-stoqembed .oembedall-tags a:hover { text-decoration: none } .oembedall-stoqembed .oembedall-post-tag { background-color: #E0EAF1; border-bottom: 1px solid #3E6D8E; border-right: 1px solid #7F9FB6; color: #3E6D8E; font-size: 90%; line-height: 2.4; margin: 2px 2px 2px 0; padding: 3px 4px; text-decoration: none; white-space: nowrap } .oembedall-stoqembed .oembedall-post-tag:hover { background-color: #3E6D8E; border-bottom: 1px solid #37607D; border-right: 1px solid #37607D; color: #E0EAF1 } .oembedall-stoqembed .oembedall-fr { float: right } .oembedall-stoqembed .oembedall-statsarrow { background-image: url("http://cdn.sstatic.net/stackoverflow/img/sprites.png?v=3"); background-repeat: no-repeat; overflow: hidden; background-position: 0 -435px; float: right; height: 13px; margin-top: 12px; width: 7px } .oembedall-facebook1 { border: 1px solid #1A3C6C; padding: 0; font: 13.34px/1.4 verdana; width: 500px } .oembedall-facebook2 { background-color: #627add } .oembedall-facebook2 a { color: #e8e8e8; text-decoration: none } .oembedall-facebookBody { background-color: #fff; vertical-align: top; padding: 5px } .oembedall-facebookBody .contents { display: inline-block; width: 100% } .oembedall-facebookBody div img { float: left; margin-right: 5px } div.oembedall-lanyard { background-attachment: scroll; background-color: transparent; background-image: none; border-width: 0; color: #112644; display: block; float: left; font-family: "Trebuchet MS", Trebuchet, sans-serif; font-size: 16px; height: 253px; line-height: 19px; margin: 0; max-width: none; min-height: 0; outline: #112644 0; padding: 0; position: relative; text-align: left; vertical-align: baseline; width: 804px } div.oembedall-lanyard .tagline { font-size: 1.5em } div.oembedall-lanyard .wrapper { overflow: hidden; clear: both } div.oembedall-lanyard .split { float: left; display: inline } div.oembedall-lanyard .prominent-place .flag:active,div.oembedall-lanyard .prominent-place .flag:focus,div.oembedall-lanyard .prominent-place .flag:hover,div.oembedall-lanyard .prominent-place .flag:link,div.oembedall-lanyard .prominent-place .flag:visited { float: left; display: block; width: 48px; height: 48px; position: relative; top: -5px; margin-right: 10px } div.oembedall-lanyard .place-context { font-size: .889em } div.oembedall-lanyard .prominent-place .sub-place { display: block } div.oembedall-lanyard .prominent-place { font-size: 1.125em; line-height: 1.1em; font-weight: 400 } div.oembedall-lanyard .main-date { color: #8CB4E0; font-weight: 700; line-height: 1.1 } div.oembedall-lanyard .first { width: 48.57%; margin: 0 0 0 2.857% } .mermaid .label { color: #333 } .node circle,.node polygon,.node rect { } .edgePath .path { } .cluster rect { } .cluster text { } .actor { } text.actor { } .actor-line { } .messageLine0 { } .messageLine1 { } #arrowhead { } #crosshead path { } .messageText { } .labelBox { } .labelText,.loopText { } .loopLine { } .note { } .noteText { font-family: "trebuchet ms", verdana, arial; font-size: 14px } .section { opacity: .2 } .section0,.section2 { } .section1,.section3 { opacity: .2 } .sectionTitle0,.sectionTitle1,.sectionTitle2,.sectionTitle3 { } .sectionTitle { font-size: 11px } .grid .tick { opacity: .3 } .grid path { } .today { } .task { } .taskText { font-size: 11px } .taskTextOutsideRight { font-size: 11px } .taskTextOutsideLeft { font-size: 11px } .taskText0,.taskText1,.taskText2,.taskText3 { } .task0,.task1,.task2,.task3 { } .taskTextOutside0,.taskTextOutside1,.taskTextOutside2,.taskTextOutside3 { } .active0,.active1,.active2,.active3 { } .activeText0,.activeText1,.activeText2,.activeText3 { } .done0,.done1,.done2,.done3 { } .doneText0,.doneText1,.doneText2,.doneText3 { } .crit0,.crit1,.crit2,.crit3 { } .activeCrit0,.activeCrit1,.activeCrit2,.activeCrit3 { } .doneCrit0,.doneCrit1,.doneCrit2,.doneCrit3 { cursor: pointer } .activeCritText0,.activeCritText1,.activeCritText2,.activeCritText3,.doneCritText0,.doneCritText1,.doneCritText2,.doneCritText3 { } .titleText { font-size: 18px } text { font-family: "trebuchet ms", verdana, arial; font-size: 14px } html { height: 100% } body { margin: 0 !important; padding: 5px 20px 26px !important; background-color: #fff; font-family: "Lucida Grande", "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Lucida Sans Unicode", Helvetica, Arial, sans-serif; font-size: .9em } br,h1,h2,h3,h4,h5,h6 { clear: both } hr.page { background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAECAYAAACtBE5DAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OENDRjNBN0E2NTZBMTFFMEI3QjRBODM4NzJDMjlGNDgiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OENDRjNBN0I2NTZBMTFFMEI3QjRBODM4NzJDMjlGNDgiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4Q0NGM0E3ODY1NkExMUUwQjdCNEE4Mzg3MkMyOUY0OCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo4Q0NGM0E3OTY1NkExMUUwQjdCNEE4Mzg3MkMyOUY0OCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PqqezsUAAAAfSURBVHjaYmRABcYwBiM2QSA4y4hNEKYDQxAEAAIMAHNGAzhkPOlYAAAAAElFTkSuQmCC") repeat-x; border: 0; height: 3px; padding: 0 } hr.underscore { border-top-style: dashed !important } body>:first-child { margin-top: 0 !important } img.plugin { } iframe { border: 0 } figure { } kbd { border: 1px solid #aaa; background-color: #f9f9f9; background-image: linear-gradient(top,#eee,#f9f9f9,#eee); padding: 1px 3px; font-family: inherit; font-size: .85em } .oembeded .oembed_photo { display: inline-block } img[data-echo] { margin: 25px 0; width: 100px; height: 100px; background: url("../img/ajax.gif") center center no-repeat #fff } .spinner { display: inline-block; width: 10px; height: 10px; margin-bottom: -.1em; border: 2px solid rgba(0,0,0,.5); border-top-color: transparent } .spinner::after { content: ""; display: block; width: 0; height: 0; position: absolute; top: -6px; left: 0; border: 4px solid transparent; border-bottom-color: rgba(0,0,0,.5) } p.toc { margin: 0 !important } p.toc ul { padding-left: 10px } p.toc>ul { padding: 10px; margin: 0 10px; display: inline-block; border: 1px solid #ededed } p.toc li,p.toc ul { list-style-type: none } p.toc li { width: 100%; padding: 0; overflow: hidden } p.toc li a::after { content: "." } p.toc li a::before { content: "? " } p.toc h5 { text-transform: uppercase } p.toc .title { float: left; padding-right: 3px } p.toc .number { margin: 0; float: right; padding-left: 3px; background: #fff; display: none } input.task-list-item { margin-left: -1.62em } .markdown { font-family: "Hiragino Sans GB", "Microsoft YaHei", STHeiti, SimSun, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "Segoe UI", AppleSDGothicNeo-Medium, "Malgun Gothic", Verdana, Tahoma, sans-serif; padding: 20px } .markdown a { text-decoration: none; vertical-align: baseline } .markdown a:hover { text-decoration: underline } .markdown h1 { font-size: 2.2em; font-weight: 700; margin: 1.5em 0 1em } .markdown h2 { font-size: 1.8em; font-weight: 700; margin: 1.275em 0 .85em } .markdown h3 { font-size: 1.6em; font-weight: 700; margin: 1.125em 0 .75em } .markdown h4 { font-size: 1.4em; font-weight: 700; margin: .99em 0 .66em } .markdown h5 { font-size: 1.2em; font-weight: 700; margin: .855em 0 .57em } .markdown h6 { font-size: 1em; font-weight: 700; margin: .75em 0 .5em } .markdown h1+p,.markdown h1:first-child,.markdown h2+p,.markdown h2:first-child,.markdown h3+p,.markdown h3:first-child,.markdown h4+p,.markdown h4:first-child,.markdown h5+p,.markdown h5:first-child,.markdown h6+p,.markdown h6:first-child { margin-top: 0 } .markdown hr { border: 1px solid #ccc } .markdown p { margin: 1em 0 } .markdown ol { list-style-type: decimal } .markdown li { display: list-item; line-height: 1.4em } .markdown blockquote { margin: 1em 20px } .markdown blockquote>:first-child { margin-top: 0 } .markdown blockquote>:last-child { margin-bottom: 0 } .markdown blockquote cite::before { content: "—?" } .markdown .code { } .markdown pre { border: 1px solid #ccc; overflow: auto; padding: .5em } .markdown pre code { border: 0; display: block } .markdown pre>code { font-family: Consolas, Inconsolata, Courier, monospace; font-weight: 700; white-space: pre; margin: 0 } .markdown code { border: 1px solid #ccc; padding: 0 5px; margin: 0 2px } .markdown img { max-width: 100% } .markdown mark { color: #000; background-color: #fcf8e3 } .markdown table { padding: 0; border-collapse: collapse; border-spacing: 0; margin-bottom: 16px } .markdown table tr td,.markdown table tr th { border: 1px solid #ccc; margin: 0; padding: 6px 13px } .markdown table tr th { font-weight: 700 } .markdown table tr th>:first-child { margin-top: 0 } .markdown table tr th>:last-child { margin-bottom: 0 } .markdown table tr td>:first-child { margin-top: 0 } .markdown table tr td>:last-child { margin-bottom: 0 } .github { padding: 20px; font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", STHeiti, SimSun, "Segoe UI", AppleSDGothicNeo-Medium, "Malgun Gothic", Arial, freesans, sans-serif; font-size: 15px; background: #fff; line-height: 1.6 } .github a { color: #3269a0 } .github a:hover { color: #4183c4 } .github h2 { border-bottom: 1px solid #e6e6e6; line-height: 1.6 } .github h6 { color: #777 } .github hr { border: 1px solid #e6e6e6 } .github pre>code { font-size: .9em; font-family: Consolas, Inconsolata, Courier, monospace } .github blockquote>code,.github h1>code,.github h2>code,.github h3>code,.github h4>code,.github h5>code,.github h6>code,.github li>code,.github p>code,.github td>code { background-color: rgba(0,0,0,.07); font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 85%; padding: .2em .5em; border: 0 } .github blockquote { border-left: 4px solid #e6e6e6; padding: 0 15px; font-style: italic } .github table { background-color: #fafafa } .github table tr td,.github table tr th { border: 1px solid #e6e6e6 } .github table tr:nth-child(2n) { background-color: #f2f2f2 } .hljs-comment,.hljs-title { color: #9c9491 } .css .hljs-class,.css .hljs-id,.css .hljs-pseudo,.hljs-attribute,.hljs-regexp,.hljs-tag,.hljs-variable,.html .hljs-doctype,.ruby .hljs-constant,.xml .hljs-doctype,.xml .hljs-pi,.xml .hljs-tag .hljs-title { color: #f22c40 } .hljs-built_in,.hljs-constant,.hljs-literal,.hljs-number,.hljs-params,.hljs-pragma,.hljs-preprocessor { color: #df5320 } .css .hljs-rules .hljs-attribute,.hljs-ruby .hljs-class .hljs-title { color: #d5911a } .hljs-header,.hljs-inheritance,.hljs-string,.hljs-value,.ruby .hljs-symbol,.xml .hljs-cdata { color: #5ab738 } .css .hljs-hexcolor { color: #00ad9c } .coffeescript .hljs-title,.hljs-function,.javascript .hljs-title,.perl .hljs-sub,.python .hljs-decorator,.python .hljs-title,.ruby .hljs-function .hljs-title,.ruby .hljs-title .hljs-keyword { color: #407ee7 } .hljs-keyword,.javascript .hljs-function { color: #6666ea } .hljs { display: block; background: #2c2421; color: #a8a19f; padding: .5em } .coffeescript .javascript,.javascript .xml,.tex .hljs-formula,.xml .css,.xml .hljs-cdata,.xml .javascript,.xml .vbscript { opacity: .5 } .MathJax_Hover_Frame { border: 1px solid #A6D !important; display: inline-block; position: absolute } .MathJax_Hover_Arrow { position: absolute; width: 15px; height: 11px; cursor: pointer } #MathJax_About { position: fixed; left: 50%; width: auto; text-align: center; border: 3px outset; padding: 1em 2em; background-color: #DDD; color: #000; cursor: default; font-family: message-box; font-size: 120%; font-style: normal; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; white-space: nowrap; float: none; z-index: 201 } .MathJax_Menu { position: absolute; background-color: #fff; color: #000; width: auto; padding: 2px; border: 1px solid #CCC; margin: 0; cursor: default; font: menu; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; white-space: nowrap; float: none; z-index: 201 } .MathJax_MenuItem { padding: 2px 2em; background: 0 0 } .MathJax_MenuArrow { position: absolute; right: .5em; color: #666 } .MathJax_MenuActive .MathJax_MenuArrow { color: #fff } .MathJax_MenuArrow.RTL { left: .5em; right: auto } .MathJax_MenuCheck { position: absolute; left: .7em } .MathJax_MenuCheck.RTL { right: .7em; left: auto } .MathJax_MenuRadioCheck { position: absolute; left: 1em } .MathJax_MenuRadioCheck.RTL { right: 1em; left: auto } .MathJax_MenuLabel { padding: 2px 2em 4px 1.33em; font-style: italic } .MathJax_MenuRule { border-top: 1px solid #CCC; margin: 4px 1px 0 } .MathJax_MenuDisabled { color: GrayText } .MathJax_MenuActive { background-color: Highlight; color: HighlightText } .MathJax_Menu_Close { position: absolute; width: 31px; height: 31px; top: -15px; left: -15px } #MathJax_Zoom { position: absolute; background-color: #F0F0F0; overflow: auto; display: block; z-index: 301; padding: .5em; border: 1px solid #000; margin: 0; font-weight: 400; font-style: normal; text-align: left; text-indent: 0; text-transform: none; line-height: normal; letter-spacing: normal; word-spacing: normal; white-space: nowrap; float: none } #MathJax_ZoomOverlay { position: absolute; left: 0; top: 0; z-index: 300; display: inline-block; width: 100%; height: 100%; border: 0; padding: 0; margin: 0; background-color: #fff; opacity: 0 } #MathJax_ZoomFrame { position: relative; display: inline-block; height: 0; width: 0 } #MathJax_ZoomEventTrap { position: absolute; left: 0; top: 0; z-index: 302; display: inline-block; border: 0; padding: 0; margin: 0; background-color: #fff; opacity: 0 } .MathJax_Preview { color: #888 } #MathJax_Message { position: fixed; left: 1px; bottom: 2px; background-color: #E6E6E6; border: 1px solid #959595; margin: 0; padding: 2px 8px; z-index: 102; color: #000; font-size: 80%; width: auto; white-space: nowrap } #MathJax_MSIE_Frame { position: absolute; top: 0; left: 0; width: 0; z-index: 101; border: 0; margin: 0; padding: 0 } .MathJax_Error { color: #C00; font-style: italic } footer { position: fixed; font-size: .8em; text-align: right; bottom: 0; margin-left: -25px; height: 20px; width: 100% }</style>
Python 模块