shutil&shelve

https://www.cnblogs.com/xiangsikai/p/7787101.html


http://www.cnblogs.com/wupeiqi/articles/4963027.html



import shutil
f1=open("file1.txt",encoding="utf-8")
f2=open("file2.txt","w",encoding="utf-8")
shutil.copyfileobj(f1,f2) #将一个文件的内容写入里一个文件;c参数为文件对象

shutil.copyfile("file1.txt","2.txt") #参数为文件名

# shutil.copystat() 复制文件的权限
# shutil.copy() #即copy文件,又copy文件权限

shutil.copytree("1","33") #递归的copy
shutil.rmtree("33") #递归的删除
# shutil.move() #移动文件

shutil.make_archive("archtest","zip","H:projectreposity eptilecardinfolink")

---------------------------------------------------------------------

shelve模块是一个简单的k,v将内存数据通过文件持久化的模块,可以持久化任何pickle可支持的python数据格式
import shelve
import datetime
m=shelve.open("shelve_test.txt")

info={"info":"sys"}
name=["列表"]
timee=datetime.datetime.now()
m["info"]=info
m["name"]=name
m["timee"]=timee

m.close()
n=shelve.open("shelve_test.txt")
print(n["info"])
print(n["name"])
print(n["timee"])


config模块

shalib 模块

re模块
原文地址:https://www.cnblogs.com/x2x3/p/10152776.html