zoukankan      html  css  js  c++  java
  • 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模块
  • 相关阅读:
    JS网页顶部进度条demo
    C# Emit动态代理生成一个实体对象
    C# 表达式树demo
    C# Thread挂起线程和恢复线程
    JS网页加载进度条
    android 布局
    工程发布问题总结
    jquery集锦
    部署maven到服务器
    WebView显示的网页在大分辨率屏下被放大--解决方案
  • 原文地址:https://www.cnblogs.com/x2x3/p/10152776.html
Copyright © 2011-2022 走看看