Swagatam Sengupta
Swagatam Sengupta

Reputation: 57

ElementTree, fromstring() error - AttributeError: 'Element' object has no attribute 'getroot'

I was using parse function to modify a xml and it worked but I tried to use .fromstring and it showed an error

AttributeError: 'Element' object has no attribute 'getroot'

here is the part of code.

AttributeError: 'Element' object has no attribute 'getroot'

Upvotes: 2

Views: 3984

Answers (1)

user11637066
user11637066

Reputation: 31

This is because the fromstring method returns the root object already. SO whatever your var that stores the information form the "fromstring()" method is, that var is the root.

Upvotes: 3

Related Questions