Skip to main content
Stefans Welt
  • Consulting
  • Archives
  • Tags
  • RSS

    Seriously, there is a function for that

    Stefan Behnel

    2010-10-29 08:23

    I keep running into code like this:

    tree = lxml.etree.parse( StringIO(bytes_data) )

    The docs are actually very clear about this. There is a function called etree.fromstring(data) that is meant to parse from a string. It is the same as in ElementTree. Obviously, no-one reads documentation. But it's there, really.

    • english
    • lxml
    • Planet Python
    • Previous post
    • Next post
    Contents © 2020 Stefan Behnel