【问题标题】:How to change attribute text in Beautiful Soap?如何更改 Beautifulsoup 中的属性文本?
【发布时间】:2022-07-07 01:26:20
【问题描述】:

如何在python中更改属性文本? 例如,在下面的 xml 中,我想用新文本替换旧文本。 旧文

【问题讨论】:

    标签: python xml xslt xsd xml-parsing


    【解决方案1】:
    for val in Record.find_all('Tagname', {'Name': 'Parent'}):
       if val.text ="old text":
       val.string = "new text"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多