zoukankan      html  css  js  c++  java
  • python修改文件的属性

    1、执行attrib系统命令

    ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [+I | -I]
    [drive:][path][filename] [/S [/D] [/L]]
    + 设置属性。
    - 清除属性。
    R 只读文件属性。
    A 存档文件属性。
    S 系统文件属性。
    H 隐藏文件属性。
    I 无内容索引文件属性。
    [drive:][path][filename]
    指定 attrib 要处理的文件。
    /S 处理当前文件夹及其所有子文件夹中的匹配文件。
    /D 也处理文件夹。
    /L 处理符号链接和符号链接目标的属性。

    example:os.system('attrib -h d:yy')

    2:os.chmod

    import stat,os
    def TestForChangeToWrite(path):
       # This is platform indepedent.     
       if not os.access(path,os.W_OK):
            os.chmod(path,stat.S_IWRITE)
    TestForChangeToWrite("c:\python26\python.exe")
  • 相关阅读:
    品优购注册页
    品优购详情页---产品细节模块product_detail
    品优购详情页---产品详细信息区域 iteminfo_wrap
    poj 3684
    POJ 2785
    POJ 3185
    POJ 3279
    POJ 3276
    POJ 2566
    POJ 2100
  • 原文地址:https://www.cnblogs.com/lcamry/p/8488043.html
Copyright © 2011-2022 走看看