file_base.py 文件源码

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

项目:keyrings.alt 作者: jaraco 项目源码 文件源码
def delete_password(self, service, username):
        """Delete the password for the username of the service.
        """
        service = escape_for_ini(service)
        username = escape_for_ini(username)
        config = configparser.RawConfigParser()
        if os.path.exists(self.file_path):
            config.read(self.file_path)
        try:
            if not config.remove_option(service, username):
                raise PasswordDeleteError("Password not found")
        except configparser.NoSectionError:
            raise PasswordDeleteError("Password not found")
        # update the file
        with open(self.file_path, 'w') as config_file:
            config.write(config_file)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号