Using beautifulsoup 4, how do I edit a value based on a name? Given I know name = “foo” (constant and unique), how do I read the value “bar” (unknown at runtime), and change it to a new string, “baz”?
I can read the line using soup.find_all(text=”foo”), but I can’t figure out how to conveniently read the value, or change the string “bar” –> “baz”
XML Excerpt:
<djmacros>
<macro name="foo" value="bar">
<description>foobar</description>
</macro>
</djmacros>
I haven’t tried it, but I would suspect something like this may work: