Easy way to get data between tags of xml or html files in python?

后端 未结 6 880
时光取名叫无心
时光取名叫无心 2021-02-06 17:05

I am using Python and need to find and retrieve all character data between tags:

I need this stuff

I then want to output

6条回答
  •  眼角桃花
    2021-02-06 17:30

    def value_tag(s):
        i = s.index('>')
        s = s[i+1:]
        i = s.index('<')
        s = s[:i]
        return s
    

提交回复
热议问题