Answer the question
In order to leave comments, you need to log in
How to take objects from xml?
import requests
from xml.etree import ElementTree
response = requests.get("https://steamcommunity.com/id/little4wingeneral/?xml=1")
tree = ElementTree.fromstring(response.content)
<steamID64>76561198975722860</steamID64>
<profile>
Answer the question
In order to leave comments, you need to log in
Working with xml is another task. I would recommend you to use BeautifulSoup:
import requests
from bs4 import BeautifulSoup
response = requests.get("https://steamcommunity.com/id/little4wingeneral/?xml=1")
soup = BeautifulSoup(response.text,"html.parser")
steamID64 = soup.select_one('steamID64').text
print(steamID64)
>>> 76561198975722860
soup = BeautifulSoup(response.text,"html.parser")
groups = soup.select('group groupID64')
for group in groups:
groupID64 = group.text
print(groupID64)
103582791429670253
103582791436397384
103582791457672580
103582791461046683
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question