Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

xml.parsers.expat.expaterror: not well-formed (invalid token): line 1, column 0

import xml.etree.ElementTree as ET
import xmltodict
import json


tree = ET.parse('your_data.xml')
xml_data = tree.getroot()
#here you can change the encoding type to be able to set it to the one you need
xmlstr = ET.tostring(xml_data, encoding='utf-8', method='xml')

data_dict = dict(xmltodict.parse(xmlstr))
Comment

PREVIOUS NEXT
Code Example
Python :: __str__ method python 
Python :: file methods in python 
Python :: python exec script 
Python :: access env variable in flask 
Python :: fibonacci series using dynamic programmig approach 
Python :: online python 
Python :: what is cross entropy loss in pytorch example 
Python :: starting variable name with underscore python 
Python :: messagebox python pyqt 
Python :: install python3 in ubuntu 
Python :: pyodbc cursor create list of dictionaries 
Python :: how to get number after decimal point 
Python :: How to Get the Intersection of Sets in Python 
Python :: transpose list 
Python :: play video in python console 
Python :: read excel date in python 
Python :: django queryset count 
Python :: python crop string 
Python :: sklearn ridge regression 
Python :: how to add values to a list in python 
Python :: how to extract field values in list from queryset in django 
Python :: run python script from repl 
Python :: logical operators pandas 
Python :: python get column from grouped dataframe 
Python :: pandas do not display index 
Python :: python find index of an item in an array 
Python :: gdscript tween 
Python :: django error handling < form 
Python :: variable in regex python 
Python :: bokeh xlabel rotate 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =