cdrom.py 文件源码

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

项目:nitro 作者: KVM-VMI 项目源码 文件源码
def add_file_from_str(self, name, content, executable=False, convert_nl=False, dedent=False):
        path = os.path.join(self.cdrom_dir, name)
        if dedent:
            content = textwrap.dedent(content)
        if convert_nl:
            content = content.replace("\n", "\r\n")
        with open(path, "w") as f:
            f.write(content)
        if executable:
            current = os.stat(path)
            os.chmod(path, current.st_mode | stat.S_IEXEC)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号