tools.py 文件源码

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

项目:cadee 作者: kamerlinlab 项目源码 文件源码
def to_disk(self, path=None, name=None):
        """read from ram, overwrite disk"""
        if not self._inram:
            raise Exception('Not in ram. Cant write to disk.')
        if path is None:
            path = self.path
        if name is None:
            name = self.name
        if not os.path.isdir(path):
            os.makedirs(path)
        with cd(path):
            with open(name, 'wb') as fil_out:
                fil_out.write(self.data)
            if self.executable:
                os.chmod(self.name, stat.S_IEXEC)
        self._ondisk = True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号