What's the best way to read XML in Python? Need help parsing! or How do I read XML files in Python ef

20 Replies, 1772 Views

ET is fine, but if docs are frying your brain, try BeautifulSoup. Yeah, it’s for HTML, but it works for XML too!

```python
from bs4 import BeautifulSoup
with open('file.xml') as f:
soup = BeautifulSoup(f, 'xml')
```
Super readable syntax. Plus, the docs are actually friendly.

Messages In This Thread



Users browsing this thread: 1 Guest(s)