Question: Create an xml file that contains the following xml code. Name the file books.xml , then answer the question below Giada De Laurentiis 2 0
Create an xml file that contains the following xml code. Name the file books.xml then answer the question below
Giada De Laurentiis
J K Rowling
James McGovern
Per Bothner
Kurt Cagle
James Linn
Vaidyanathan Nagarajan
Erik T Ray
Fix the errors in the code below so that it reads the data from books.xml and finds all of the book data and prints the title for each book and then finds all the author names for each book and prints each author name.
import xmletree.ElementTree as ET
fh openbooksxml
data fhread
fhclose
tree ETfromstringdata
booklist tree.findbook
for book in booklist:
printfBook title: bookfindtitletext
authorlist book.findauthor
for author in authorlist:
printfAuthor: author
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
