You are given an XML document. Your program should read a string representing this document from input. The second line of input contains an attribute name that you should find in the root element. If the root contains this attribute, output its value. Otherwise, output None.
XML in Python
Find attribute
Report a typo
Sample Input 1:
<a attr="123"><b>hello</b><c/></a>
attrSample Output 1:
123Sample Input 2:
<root a1="aba" a2="caba"/>
a3Sample Output 2:
NoneWrite a program in Python 3
from lxml import etree
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.