tv_grab_channel.py 文件源码

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

项目:tvgrabpyAPI 作者: tvgrabbers 项目源码 文件源码
def add_starttag(self, tag, ident = 0, attribs = '', text = '', close = False):
        '''
        Add a starttag with optional attributestring, textstring and optionally close it.
        Give it the proper ident.
        '''
        if isinstance(attribs, dict):
            a = ''
            for k, v in attribs.items():
                a = '%s %s=%s' % (a, k, saxutils.quoteattr(v))

            attribs = a

        if attribs != '':
            attribs = ' %s' % attribs

        if close and text == '':
            return u'%s<%s%s/>\n' % (''.rjust(ident), self.xmlescape(tag), attribs)

        if close and text != '':
            return u'%s<%s%s>%s</%s>\n' % (''.rjust(ident), self.xmlescape(tag), attribs, self.xmlescape(text), self.xmlescape(tag))

        else:
            return u'%s<%s%s>%s\n' % (''.rjust(ident), self.xmlescape(tag), attribs, self.xmlescape(text))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号