transform.py 文件源码

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

项目:ome-model 作者: ome 项目源码 文件源码
def map(self, function, kind):
        """Applies a function to the ``data`` element of events of ``kind`` in
        the selection.

        >>> html = HTML('<html><head><title>Some Title</title></head>'
        ...               '<body>Some <em>body</em> text.</body></html>',
        ...             encoding='utf-8')
        >>> print(html | Transformer('head/title').map(unicode.upper, TEXT))
        <html><head><title>SOME TITLE</title></head><body>Some <em>body</em>
        text.</body></html>

        :param function: the function to apply
        :param kind: the kind of event the function should be applied to
        :rtype: `Transformer`
        """
        return self.apply(MapTransformation(function, kind))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号