How can I set a value to a field from python?

Hello,

I have a generated XML data and I want to set this data(XML) to a field(type:code) on the doctype, So is there any idea How to do it only using python? or javascript is needed ?

Have you got the answer for this?