一、模块

1.模块

(1)定义:一个.py文件就是一个模块

(2)原因:为了防止程序代码越来越长,对函数进行分组放到不同的文件夹里。

(3)优点:提高代码的可维护性;模块编写完毕可以被别人引用,也可以引用其他模块;可以避免变量名和函数名冲突

(4)模块种类:一共有三种①python标准库;②第三方模块;③应用程序自定义模块

2.模块导入方法

  模块导入的本质:通过sys.path找到要导入的函数并执行该脚本,(1)方法会将变量名加载到变量空间,(2)会将变量名加载进来

(1)import 语句

import time
time.sleep(2)
print("OK")

(2)from...import语句

from module_test import cal
res = cal(1,2)
print(res

(3)from...import*语句

from module_test import *#不推荐这种方法,会有可能覆盖自己定义的函数(函数即变量)
res1 = cal(2,3)
res2 = sub(4,2)
print(res1,res2)

3.包

  为了避免模块冲突,按目录来组织模块,这种目录就交包,包目录下面会有一个__init__文件,这是包和普通文件夹的区别

  只要顶层包名称不冲突,包下面所有的模块都不会冲突

多层包引用

from test1.test2.module_test import cal
res = cal(1,2)
print(res)

4.测试代码

if __name__=="__main__":

  两个特性:1.在执行代码中显示“__main__”;2.在调用模块中显示所在文件名称

(1)功能一:

  在调试代码的时候加入,从另外一个.py文件调用该模块时,不会显示调试的内容

def cal(x,y):return (x+y)
def sub(x,y):return (x-y)
if __name__=="__main__":print ("ok")

(2)功能二:在执行代码中,防止自己的逻辑代码被别人调用

二、time模块

1.时间戳

import time
print(time.time())#时间戳 秒数,从1970年凌晨开始算,Unix的诞生时间

2.结构化时间

import time
print(time.localtime())#当地时间
print(time.gmtime())#UTC时

(1)将结构化时间转化为时间戳

import time
print(time.mktime(time.localtime()))

(2)将结构化时间转化为字符串时间

import time
print(time.strftime("%Y-%m-%d  %X",time.localtime()))

3.字符串时间

import time
t = time.localtime()
print(time.asctime(t))
print(time.ctime(1124324))

(1)将字符串时间转化为结构化时间

import time
print(time.strptime("2018-5-11 21:01:26","%Y-%m-%d %X"))

4.time.sleep()和time.clock()

(1)time.sleep()

  time.sleep() 推迟指定的时间运行,单位为秒

(2)time.clock()

  time.clock()函数以浮点数计算的秒数返回当前的CPU时间。用来衡量不同程序的耗时,比time.time()更有用。这个需要注意,在不同的系统上含义不同。在UNIX系统上,它返回的是"进程时间",它是用秒表示的浮点数(时间戳)。而在WINDOWS中,第一次调用,返回的是进程运行的实际时间。而第二次之后的调用是自第一次调用以后到现在的运行时间。(实际上是以WIN32上QueryPerformanceCounter()为基础,它比毫秒表示更为精确)

import time
print(time.clock())
time.sleep(2)
print(time.clock())

5.datetime模块

(1)显示当前时间

import datetime
print(datetime.datetime.now())

三、random模块

1.random模块主要有以下几个功能

import random
print(random.random())#随机生成一个小于1的浮点数
print(random.randint(1,3))#随机生成一个整型,可以取到3
print(random.randrange(1,3))#随机生成一个整型,取不到3
print(random.choice([11,22,33,44]))#从列表中随机选取一个数
print(random.sample([11,22,33,44],2))#从列表中随机选取两个数
print(random.uniform(1,4))#生成指定范围内的浮点数
ret = [1,2,3,4,5]
random.shuffle(ret)#打乱顺序
print(ret)

2.生成验证码

import random
def v_code():ret = ""for i in range(4):num = random.randint(0,9)letter = chr(random.randint(65,90))s = str(random.choice([num,letter]))ret += sreturn ret
print(v_code())

四、os模块

1.os模块主要有以下功能

import os
os.getcwd()#获取当前的工作目录,即当前Python脚本的工作目录
os.chdir("D:\python_s3\day22")#改变当前脚本工作目录
os.curdir#返回当前目录:(".")
os.pardir#返回当前目录的父目录的字符串名:("..")
os.makedirs("test1/test2")#生成多层递归目录
os.removedirs("test2")#若目录为空,则删除,并递归到上一级目录,若为空也删除,以此类推
os.mkdir("test")#在当前工作目录生成单级目录
os.rmdir("test")#删除单级目录,若不为空,无法删除并报错
os.listdir()#列出指定目录下的所有文件和子目录,包括隐藏文件,以列表的方式打印
os.remove("test1.py")#删除文件
os.rename("test.py","test1.py")#重命名文件或目录
os.stat("D:\python_s3")#获取文件/目录信息
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="D:\python_s3\day22\os模块.py")#返回path规范化的绝对路径
os.path.split("D:\python_s3\day22\__init__.py")#将path分割成目录和文件名二元组返回,中文不行
os.path.dirname("D:\python_s3\day22\__init__.py")#目录
os.path.basename("D:\python_s3\day22\__init__.py")#文件名
os.path.exists("D:\python_s3\day22\__init__.py")#判断路径是否存在,存在返回True,不存在返回False
os.path.isabs("D:\python_s3\day22\__init__.py")#判断是否是绝对路径
os.path.isfile("D:\python_s3\day22\__init__.py")#判断是否是存在的文件
os.path.isdir("D:\python_s3\day22")#判断是否是存在的目录
os.path.join("D:/python_s3/","day22/","test1.py")#拼接路径返回
os.path.getatime("D:\python_s3\day22\test1.py")#返回文件或目录最后存取时间
os.path.getmtime("D:/python_s3/day22/test1.py")#返回文件或目录最后修改时间

五、sys模块

1.sys模块主要有以下功能

import sys
print(sys.argv)#输出当前路径
print(sys.version)#获取当前Python解释器版本信息
print(sys.path)#返回模块的搜索路径,初始化时使用Python环境变量的值
print(sys.platform)#打印操作系统平台名称
sys.exit(0)#退出系统,下面的命令不会执行

2.进度条功能

import sys,time
for i in range(100):sys.stdout.write("#")time.sleep(0.1)sys.stdout.flush()

六、json&pickle模块

1.json模块

  序列化:把对象(变量)从内存中变成可存储或传输的过程叫序列化,序列化在Python中叫picking,在其他编程语言中也被称为serialization、marshalling、flattening等

  反序列化:把变量内容从序列化的对象重读到内存中的过程叫反序列化,unpicking

(1)json功能和eval相似,但json应用范围更广泛

  如果要在不同的编程语言之间传递对象,就要把对象序列化为标准格式,json是较好的序列化方法

a.eval:

f_read=open("hello","r")
data=f_read.read()
print(type(data))
data = eval(data)
print(data["name"])

b.json:

import json
dict={'name':"dazui"}
data=json.dumps(dict)
print(data)
i = 90
i = json.dumps(i)
print(i,type(i))
s = 'hello'
s = json.dumps(s)
print(s,type(s))
l = [11,22]
print(json.dumps(l))

(2)json.dumps和json.loads

  如下代码所示:

import json
dic = {'name':'dazui'}
dic_str =json.dumps(dic)
f = open("new_hello","w")
f.write(dic_str)f_read=open("new_hello","r")
data = json.loads(f_read.read())
print(data,type(data))
print(data["name"])

  json.loads用来把json.dumps处理的字符串变为原来的值,相当于一个返的过程

(3)json.dump和json.load

  与json.dumps和json.loads功能相似

json.dump(dic,f)
#相当于
dic_str =json.dumps(dic)
f.write(dic_str)data=json.load(f)
#相当于
f_read=open("new_hello","r")
data = json.loads(f_read.read())

2.pickle模块

  pickle模块与json模块类似,但在读取和写入的时候需要用b模式,同时,pickle只能用于Python中。

import pickle
dic = {'name':'dazui'}
f = open("new_hello","wb")#与json有区别,需要用b模式写入
dic_str =pickle.dumps(dic)
f.write(dic_str)f_read=open("new_hello","rb")#与json有区别,需要用b模式读取
data = pickle.loads(f_read.read())
print(data,type(data))
print(data["name"])

七、shelve模块

  shelve模块比pickle模块简单,只有一个open函数,返回类似字典的对象。

import shelve
f = shelve.open(r"NBA")
# f["team1"]={"name":"Lakers","Division":"Pacific"}
# f["team2"]={"name":"Warriors","Division":"Pacific"}
# f.close()
print(f.get("team1")["name"])
print(f.get("team1")["Division"])

八、xml模块

  xml是实现不同语言或程序之间进行数据交换的协议,与json类似但不如json操作简单,由于出现时间较早,现在许多传统公司的系统接口还是用xml,如金融行业。

1.查看修改删除

import xml.etree.ElementTree as ET#将导入模块命名为ET

tree = ET.parse("xml_lesson")
root = tree.getroot()
print(root.tag)遍历xml文档
for child in root:print(child.tag,child.attrib)for i in child:print(i.tag,i.text)只遍历year节点
for node in root.iter("year"):print(node.tag,node.text)修改
for node in root.iter("year"):new_year = int(node.text)+1node.text = str(new_year)node.set("updated","yes")tree.write("xml_lesson")删除
for country in root.findall("country"):rank = int(country.find("rank").text)if rank >50:root.remove(country)
tree.write("xml_lesson")

2.创建xml文档

#创建xml文档
import xml.etree.ElementTree as ET#将导入模块命名为ET
new_xml = ET.Element("namelist")
name = ET.SubElement(new_xml,"name",attrib={"enrolled":"yes"})
age = ET.SubElement(name,"age",attrib={"checked":"no"})
sex = ET.SubElement(name,"sex")
sex.text="33"
name2 = ET.SubElement(new_xml,"name",attrib={"enrolled":"no"})
age = ET.SubElement(name2,"age")
age.text = "19"et = ET.ElementTree(new_xml)#生成文档对象
et.write("test.xml",encoding="utf-8",xml_declaration=True)ET.dump(new_xml)#打印生成格式

九、re模块

1.re模块本质

  正则表达式(RE)是一种小型的、高度专业化的编程语言,内嵌在Python中并通过re模块实现。正则表达式被编译成字节码,由c语言编写的匹配引擎执行

  作用:主要用来模糊匹配

2.re模块下的方法

(1)re.findall()

import re
print(re.findall('zui','dazuizuigezuizui'))#用列表返回所有满足匹配条件的结果

(2)re.search()和re.match()

import re
print(re.search("zui",'dazuizuigezuizui'))#在字符串中搜索,匹配成功返回第一个匹配到的值,不成功返回None
print(re.match("dazui","dazuizuigezuizui"))#在字符串开头匹配,匹配成功需要.grup输出结果,不成功返回None

(3).group()

import re
a = "123abc456"
print(re.search("([0-9]*)([a-z]*)([0-9]*)",a).group(0))   #123abc456,返回整体
print(re.search("([0-9]*)([a-z]*)([0-9]*)",a).group(1))   #123
print(re.search("([0-9]*)([a-z]*)([0-9]*)",a).group(2))   #abc
print(re.search("([0-9]*)([a-z]*)([0-9]*)",a).group(3))   #456

(4)re.split()

import re
print( re.split("[ab]","abcd"))#先按"a"分割得到""和"bcd",再按"b"分割得到""和"cd"

(5)re.sub()和re.subn()

import re
print(re.sub("\d","dazui","adc1abc2",1))#按规则匹配到字符,将字符替换成指定字符串,"1"用来指定匹配个数
print(re.subn("\d","dazui","abc1abc2abc3"))#按规则匹配字符并替换,打印替换后的字符串和替换的个数

(6)re.compile

import re
obj = re.compile("\d{3}")#编译规则
ret = obj.search("abc123abc456")
print(ret.group())#123

(7)re.finditer()

import re
ret = re.finditer("\d","ab1c2bd3e4f5")
print(ret)
print(next(ret).group())#1
print(next(ret).group())#2
print(next(ret).group())#3
print(next(ret).group())#4

3.字符匹配(普通字符和元字符)

  普通字符匹配:

import re
print(re.findall('dazui','dazuizuigezuizui'))

  元字符:.  ^  $  *  +  ?  {}  |  \  []  ()

4.元字符

(1).  ^  $  *  +  ?  {}

import re
#  .  ^  $  *  +  ?  {}
print(re.findall("..zui","dazuizuizuizuige"))#["dazui","uizui"] "."代替一个字符
print(re.findall("^dazui","zuidazuizuizuige"))#[],"^"是否以XXX开头
print(re.findall("zuige$","zuidazuizuizuige"))#["zuige"],"$"是否以XXX结尾
print(re.findall("dazui*","dazuiiiizuizuizuigeiii"))#['dazuiiii'],"*"贪婪匹配(0,+∞)
print(re.findall("dazui+","dazuiiiizuizuizuigeiii"))#['dazuiiii'],"+"贪婪匹配(1,+∞)
print(re.findall("dazui?","dazuiiiizuizuizuigeiii"))#['dazui'],"?"贪婪匹配(0,1)
print(re.findall("dazui{2,3}","dazuiiiizuizuizuigeiii"))#['dazuiii'],"{}"贪婪匹配,自己定义范围

  将  *  +  ?  {}  贪婪匹配变为惰性匹配

print(re.findall("dazui*?","dazuiiiizuizuizuigeiii"))#['dazu'],贪婪匹配变为惰性匹配

(2)[]字符集

import re
print(re.findall("da[az]ui","dazuidaduidaaui"))#['dazui', 'daaui'],[az],a或z#三个特殊字符
print(re.findall("da[a-z]ui","dazuidaduixiaozui"))#['dazui', 'dadui'],[a-z],a到z中任意一个
print(re.findall("da[^a-z]ui","da2uidaduixiaozui"))#['da2ui'],[^a-z],不能是a到z中任意一个
print(re.findall("da[\^a-z]ui","da^uida2zidazui"))#['da^ui', 'dazui'],[\^a-z],^或a到z中的任意一个,\的作用是把有特殊意义的字符变得没特殊意义

(3)\转义字符

  反斜杠后面跟元字符可以去除元字符的功能,如\^

  反斜杠后面跟普通字符可以实现特殊功能,如\d

'''
\d 匹配任意十进制数,相当于类[0-9]
\D 匹配任意非数字字符,相当于类[^0-9]
\s 匹配任意空白字符,相当于类[\t\n\r\f\v]
\S 匹配任意非空白字符,相当于类[^\t\n\r\f\v]
\w 匹配任意字母数字字符下划线和汉字,相当于类[a-zA-Z0-9_]
\W 匹配任意非字母数字字符,相当于类[^a-zA-Z0-9_]
\b 匹配一个特殊字符边界,如空格、&、#等
'''
import re
print(re.findall("I\b","I am hehcouzi"))#[]
print(re.findall(r"I\b","I am hehcouzi"))#['I']#python解释器也用\进行转义,了解,r代表row string
print(re.findall("c\l","abc\le"))#[]
print(re.findall("c\\l","abc\le"))#[]
print(re.findall("c\\\\l","abc\le"))#['c\\l']
print(re.findall(r"c\\l","abc\le"))#['c\\l']print(re.findall("\bblow","blow"))#[]
print(re.findall(r"\bblow","blow"))#['blow']

(4)()分组

import re
print(re.findall("(ad)+","adad"))#['ad']
print(re.findall("(?:ad)+","adad"))#['adad'],去优先级

(5)|

import re
print(re.findall("a|b","abc"))#['a', 'b']

十、logging模块

1.简单应用

import logginglogging.debug("嘴嘴")
logging.info("嘴哥")
logging.warning("大嘴")
logging.error("克格莫")
logging.critical("深渊巨口")

  默认情况下,logging模块将日志打印到标准输出中,且只显示WARNING及以上级别的日志

  日志级别:CRITICAL>ERROR>WARNING>INFO>DEBUG

2.logging.basicConfig  灵活配置日志级别、日志格式、输出位置

import logging
logging.basicConfig(level=logging.DEBUG,format="%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s",datefmt=" %a, %d %b %Y %H:%M:%s",filename="D:\python_s3\day22\test.log",filemode="w")
logging.debug("1")
logging.info("2")
logging.warning("3")
logging.error("4")
logging.critical("5")

  在logging.basicConfig()函数中可通过参数来更改logging模块默认行为

  filename:用指定的文件名创建FiledHandler,日志会被存储在指定的文件中

  filemode:文件打开方式,在指定了filename时使用这个参数,默认值为“a”,还可以指定为“w”

  format:指定handler使用的日志显示格式

  datefmt:指定日期时间格式

  level:设置rootlogger的日志级别

  stream:用指定的stream创建StreamHandler。可以指定输出到sys.stder,sys.stout或者文件(f=open("test.log",w)).

  format参数中可能用到的格式化串:

    %(name)s   Logger的名字

    %(levelno)s  数字形式的日志级别

    %(levelname)s  文本形式的日志级别

    %(pathname)s   调用日志输出函数的模块的完整路径名,可能没有

    %(filename)s  调用日志输出函数的模块的文件名

    %(module)s  调用日志输出函数的模块名

    %(funcName)s  调用日志输出函数的函数名

    %(lineno)d  调用日志输出函数的语句所在的代码行

    %(created)f  当前时间,用Unix标准的表示时间的浮点数表示

    %(relativeCreated)d  字Logger创建以来到输出日志信息时的毫秒数

    %(asctime)s  用字符串形式显示当前时间。默认格式是“年-月-日 时:分:秒,毫秒”

    %(thread)d  线程ID,可能不存在

    %(threadName)s  线程名,可能不存在

    %(process)d  进程ID,可能不存在

    %(message)s  用户输出的消息

3.logger对象

(1)

import logging
def logger():logger = logging.getLogger()fh = logging.FileHandler("test1.log")#创建一个handler,用于写入日志文件ch = logging.StreamHandler()#再创建一个handler,用于输出到控制台fm = logging.Formatter("%(asctime)s %(name)s %(levelname)s %(message)s")fh.setFormatter(fm)ch.setFormatter(fm)logger.addHandler(fh)logger.addHandler(ch)logger.setLevel("DEBUG")return loggerlogger=logger()
logging.debug("嘴嘴")
logging.info("嘴哥")
logging.warning("大嘴")
logging.error("克格莫")
logging.critical("深渊巨口")

  logging库提供了多个组件:Logger、Handler、Filter、Formatter。Logger对象提供应用程序可直接使用的接口,Handler发送日志到适当的目的地,Filter提供了过滤日志信息的方法,Formatter指定日志显示格式。

  Logger是一个树形层级结构,输出信息之前都要获得一个Logger(如果没有显示的获取,则自动创建并使用root Logger)

  logger=logging.getLogger(),返回一个默认的Logger即root Logger,并应用默认的日志级别、Handler和Formatter设置。

(2)

#两个logger打印结果以后定义的为准(一切皆变量)
import logging
logger = logging.getLogger()
logger1 = logging.getLogger("mylogger")
logger2 = logging.getLogger("mylogger")#logger2和logger1s是同一个对象

fh = logging.FileHandler("test_new.log")  # 创建一个handler,用于写入日志文件
ch = logging.StreamHandler()  # 再创建一个handler,用于输出到控制台

logger1.addHandler(fh)
logger1.addHandler(ch)logger2.addHandler(fh)
logger2.addHandler(ch)logger1.setLevel(logging.DEBUG)
logger2.setLevel(logging.INFO)logger1.debug("嘴嘴")
logger1.info("嘴哥")
logger1.warning("大嘴")
logger1.error("克格莫")
logger1.critical("深渊巨口")logger2.debug("嘴嘴")
logger2.info("嘴哥")
logger2.warning("大嘴")
logger2.error("克格莫")
logger2.critical("深渊巨口")

  logger1和logger2对应的是同一个Logger实例,只要logging.getLogger(name)中名称参数name相同则返回的Logger实例就是同一个,且仅有一个,即name与Logger实例一一对应。

(3)

#父辈如果有输出,子辈要多输出依次
import logging
logger = logging.getLogger()
logger1 = logging.getLogger("mylogger")fh = logging.FileHandler("test_new.log")  # 创建一个handler,用于写入日志文件
ch = logging.StreamHandler()  # 再创建一个handler,用于输出到控制台

logger1.addHandler(fh)
logger1.addHandler(ch)logger.addHandler(fh)
logger.addHandler(ch)logger1.setLevel(logging.DEBUG)
logger.setLevel(logging.ERROR)logger1.debug("嘴嘴")
logger1.info("嘴哥")
logger1.warning("大嘴")
logger1.error("克格莫")
logger1.critical("深渊巨口")logger.debug("嘴嘴")
logger.info("嘴哥")
logger.warning("大嘴")
logger.error("克格莫")
logger.critical("深渊巨口")

  通过logger = logging.getLogger()创建root logger,其余的创建的是子辈logger,父辈打印的时候照常,子辈在打印的时候会向上找父辈,如果父辈存在,子辈会多打印一次。

十二、configparser模块(配置文件的解析模块)

1.创建文档

import configparser
config = configparser.ConfigParser()  #config={}
#给空字典加键值对
config["DEFAULT"]={"ServerAliveInterval":"45","Compression":"yes","CompressionLevel":"9"}config["bitbucket"]={}
config["bitbucket"]["User"]="hg"config["topsecret.server.com"]={}
topsecret =config["topsecret.server.com"]
topsecret["Host Port"]="50022"
topsecret["ForwardX11"]="no"
#写入
with open("configtest","w") as f:config.write(f)

2.查看、增加和删除

import configparser
config = configparser.ConfigParser()  #config={}
#>>>>>>>>>>>>>>>查看
print(config.sections())#[]
config.read("configtest")
print(config.sections())#['bitbucket', 'topsecret.server.com']
print("topsecret.server.com"in config)#True
print(config["bitbucket"]["UsEr"])#hg,user不区分大小for key in config['bitbucket']:#打印user serveraliveinterval compression compressionlevelprint(key)
print(config.options("bitbucket"))#打印['user', 'serveraliveinterval', 'compression', 'compressionlevel']
print(config.items("bitbucket"))#打印[('serveraliveinterval', '45'), ('compression', 'yes'), ('compressionlevel', '9'), ('user', 'hg')]
print(config.get("bitbucket","compression"))#打印compression的值#>>>>>>>>>>>>>增
config.add_section("Lakers")
config.set("Lakers","Kobe","0824")
# config.write(open("configtest","w"))#>>>>>>>>>>>>删除
config.remove_section("topsecret.server.com")
config.remove_option("bitbucket","user")
config.write(open("configtest","w"))

十三、hashlib模块

  hashlib模块主要用于加密的相关操作,在Python3.x版本中,替代了md5和sha模块,主要提供SHA1,SHA224,SHA256,SHA384,SHA512,MD5算法

加密算法存在缺陷,通过撞库可以反解,所以需要在加密算法中自定义key再来加密。

import hashlib
obj = hashlib.md5("hello".encode("utf-8"))
print(obj.hexdigest())#5d41402abc4b2a76b9719d911017c592
obj.update("你好".encode("utf-8"))
print(obj.hexdigest())#2cfe361166078c59730c075c966bfe91
obj=hashlib.md5("hello你好".encode("utf-8"))
print(obj.hexdigest())#2cfe361166078c59730c075c966bfe91#加密
sha =hashlib.sha256("用来加密别人不知道".encode("utf-8"))
sha.update("hello".encode("utf-8"))
print(sha.hexdigest())#9f95aeca58b1d2c0bc36f2e73037c67d9022bceadcfa01a2b0b7724e631c7bf7

转载于:https://www.cnblogs.com/hechengwei/p/9026763.html

Python开发——8.模块相关推荐

  1. python开发sdk模块

    一.开发模块目的 通过setup.py将框架安装到python环境中,开发成第三方模块来, 以此来调用,增加使用方便及安全高效性 二.编写setup.py文件 #!/usr/bin/env pytho ...

  2. python如何离线安装第三方模块_扣丁学堂python开发之第三方模块pip离线安装

    扣丁学堂python开发之第三方模块pip离线安装 2018-08-14 14:02:22 747浏览 最近很多参加Python培训的同学说在学习过程中需要安装一些第三方的模块,今天小编就来给大家讲一 ...

  3. Python开发【第六篇】:模块

    Python开发[第六篇]:模块 模块,用一砣代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合.而对于一 ...

  4. Python开发【Part 7】:常用模块

    本节内容: 模块介绍 自定义模块 开源模块 os模块 sys模块 hashlib模块 json和pickle模块 shutil模块 ConfigParser模块 logging模块 time模块 re ...

  5. python 图形化开发用什么模块_用python进行GUI开发的选择/python的GUI模块(图形界面开发库)...

    Python最大的特点就在于她的快速开发功能.作为一种胶水型语言,python几乎可以渗透在我们编程过程中的各个领域.这里我简单介绍一下用python进行gui开发的一些选择. 1.Tkinter T ...

  6. 想做Python开发,这8种常用Python模块,你必须得知道!

    8种常用Python模块 前言 time模块 1.时间戳(timestamp) 2.格式化的时间字符串(Format String) 3.结构化的时间(struct time) datetime模块 ...

  7. python中导入模块是用哪个关键字_python中导入模块的关键字是什么_后端开发

    c语言中\t是什么意思_后端开发 C语言的[\t]代表的意思是水平制表符,相当于按了键盘上的TAB按键,通常宽度相当于8个空格的位置,但有些软件允许设置tab的宽度,在双引号或定界符表示的字符串中有效 ...

  8. 【Python】第一模块,开发基础

    Python开发工具课前预习 01 Python全栈开发课程介绍1 02 Python全栈开发课程介绍2 03 Python全栈开发课程介绍3 04 编程语言介绍(一) 05 编程语言介绍(二)机器语 ...

  9. python全栈开发之正则表达式和python的re模块

    正则表达式和python的re模块 python全栈开发,正则表达式,re模块 一 正则表达式 正则表达式(Regular Expression)是一种文本模式,包括普通字符(例如,a 到 z 之间的 ...

  10. Python开发系列课程(7) - 函数和模块的使用

    函数和模块的使用 在讲解本章节的内容之前,我们先来研究一道数学题,请说出下面的方程有多少组正整数解. x1+x2+x3+x4=8x1+x2+x3+x4=8 x_1 + x_2 + x_3 + x_4 ...

最新文章

  1. flashpaper打印机没有被正确安装_没有正确保存与安装,可导致80%的轴承提早失效...
  2. flink 5-窗口和时间
  3. .Net Core微服务入门全纪录(完结)——Ocelot与Swagger
  4. 使用Maven Jetty插件
  5. 隐藏域input里面放当前时间_【小A问答】Win10的隐藏小秘密,被我发现了!
  6. 【系统设计】详细设计说明书
  7. windows安装fdfs_lient报错fdfs_client/sendfilemodule: fatal error C1189: #error: platfom not supported
  8. 本地传奇架设详细教程
  9. ZYNQ---PL端扩展串口
  10. 日常工作常用的几款小工具
  11. 基于全数字摄影测量工作站制作DOM简介
  12. 2018年度总结(人若无名,专心练剑)
  13. IBM X系列服务器、刀片中心安装指南和用户手册、操作系统安装指南(中文版)汇总
  14. Linux学习(三):管道相关命令
  15. xp如何添加桌面计算机回收站,xp系统桌面回收站不见了怎么办
  16. 多种卫星遥感数据反演光合有效辐射数据服务
  17. 往往取决于他所遇到困难的程度
  18. TechExcel混合敏捷研发培训在伦敦举办
  19. java 文件目录是否存在_java中判断文件目录是否存在的方法
  20. 网络计划经典例题讲解

热门文章

  1. ZlycerQan的 八云蓝(ran )
  2. CoffeeScript是什么
  3. 一些关于coffeescript
  4. c语言切蛋糕问题程序设计报告,c语言切蛋糕问题,问题如图。望大神指教。
  5. LLVM创始人Chris Lattner回顾展望编译器
  6. 提示GuestAdditions versions on your host (6.1.32) and guest (6.1.22) do not match错误的解决方法
  7. PyCharm下载及安装教程(Windows)
  8. Rabbit MQ消息队列原理
  9. 学做智能车--电磁探究篇
  10. php文章下一页,php获取文章上一页与下一页的方法,_PHP教程