当前位置: 首页>>代码示例>>Python>>正文


Python html.replace方法代码示例

本文整理汇总了Python中future.backports.html.replace方法的典型用法代码示例。如果您正苦于以下问题:Python html.replace方法的具体用法?Python html.replace怎么用?Python html.replace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在future.backports.html的用法示例。


在下文中一共展示了html.replace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _quote_html

# 需要导入模块: from future.backports import html [as 别名]
# 或者: from future.backports.html import replace [as 别名]
def _quote_html(html):
    return html.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;") 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:4,代码来源:server.py

示例2: send_error

# 需要导入模块: from future.backports import html [as 别名]
# 或者: from future.backports.html import replace [as 别名]
def send_error(self, code, message=None):
        """Send and log an error reply.

        Arguments are the error code, and a detailed message.
        The detailed message defaults to the short entry matching the
        response code.

        This sends an error response (so it must be called before any
        output has been generated), logs the error, and finally sends
        a piece of HTML explaining the error to the user.

        """

        try:
            shortmsg, longmsg = self.responses[code]
        except KeyError:
            shortmsg, longmsg = '???', '???'
        if message is None:
            message = shortmsg
        explain = longmsg
        self.log_error("code %d, message %s", code, message)
        # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201)
        content = (self.error_message_format %
                   {'code': code, 'message': _quote_html(message), 'explain': explain})
        self.send_response(code, message)
        self.send_header("Content-Type", self.error_content_type)
        self.send_header('Connection', 'close')
        self.end_headers()
        if self.command != 'HEAD' and code >= 200 and code not in (204, 304):
            self.wfile.write(content.encode('UTF-8', 'replace')) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:32,代码来源:server.py

示例3: copyfile

# 需要导入模块: from future.backports import html [as 别名]
# 或者: from future.backports.html import replace [as 别名]
def copyfile(self, source, outputfile):
        """Copy all data between two file objects.

        The SOURCE argument is a file object open for reading
        (or anything with a read() method) and the DESTINATION
        argument is a file object open for writing (or
        anything with a write() method).

        The only reason for overriding this would be to change
        the block size or perhaps to replace newlines by CRLF
        -- note however that this the default server uses this
        to copy binary data as well.

        """
        shutil.copyfileobj(source, outputfile) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:17,代码来源:server.py


注:本文中的future.backports.html.replace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。