Skip to content

Commit

Permalink
Update parsingXML.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
barbarer committed Nov 1, 2023
1 parent b5a19b4 commit 28da05f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions _sources/web/parsingXML.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Look at the code below and predict what will be printed.

What is the last thing (last line of text) that will be printed when the code below runs?

- :['"]?Attr\s*['"]?yes['"]?: It prints "Attr " plus the value of the hide attribute in the email tag.
- :['"]?Attr\:\s*['"]?yes['"]?: It prints "Attr " plus the value of the hide attribute in the email tag.
:['"]?yes['"]?: Something will be printed before the value. Look at the print statement again.
:.*: What is the value of the hide attribute?

Expand All @@ -33,8 +33,8 @@ elements from the XML:
</person>'''

tree = ET.fromstring(data)
print('Name ', tree.find('name').text)
print('Attr ', tree.find('email').get('hide'))
print('Name: ', tree.find('name').text)
print('Attr: ', tree.find('email').get('hide'))

The triple single quote (``'''``), as well as the triple double quote (``"""``),
allow for the creation of strings in Python that span multiple lines.
Expand Down

0 comments on commit 28da05f

Please sign in to comment.