facto.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:ansibilo 作者: Polyconseil 项目源码 文件源码
def write(filename, data, undisclosed=False):
    """
    Write JSON data to (owner only readable) file.

    This will also create missing directories.

    Args:
        filename (str): file path
        data (str): data to write
        undisclosed (bool): whether data should be owner only readable
    """
    makedirs(os.path.dirname(filename))
    with open(filename, 'w') as fp:
        if undisclosed:
            os.chmod(filename, stat.S_IRUSR | stat.S_IWUSR)
        json.dump(data, fp)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号