Use the parent method and print a parent tag of the son tag.
BeautifulSoup: working with XML
Who are you, kid?
Report a typo
Write a program in Python 3
from bs4 import BeautifulSoup
families = '<?xml version="1.0" encoding="UTF-8"?> <families><family name="Swan-Dwyer"><parent name="Charlie"/><parent name="Renee"/><daughter name="Isabella"/></family><family name="Cullen-Hale"><parent name="Carlisle"/><parent name="Esme"/><daughter name="Alice"/><son name="Emmet"/><daughter name="Rosalie"/><son name="Jasper"/><son name="Edward"/></family></families>'
# put your code here
___
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.