Learn How To Convert XML To JSON Using Xmltodict In Python

preview_player
Показать описание
Hi,

Tek Science videos motive is to provide high quality and easy learning of the concepts in python. The Tek Science videos will be useful while working on python projects.

================================================================================
Promotion : Solvid uses effective search engine optimisation, content marketing and link building efforts to catapult your rankings, drive organic traffic and generate sales.

You can visit their website using the following links :
================================================================================

To watch further videos subscribe our youtube channel TKScience Videos.

Thank You For Watching!!
Рекомендации по теме
Комментарии
Автор

Concepts is clear but try removing the noise from the video. Good Job :)

punithalakshmi
Автор

Thank you for putting this video and the information together. I am a newbie to programming, I have worked a little bit with Javascript and NodeJS, trying to learn Python now, but for me, it is learning by trying to use code to solve a problem. Do you have any info on how to take it a step further and receive an HTTP Post with XML Data and converting it to JSON?

Also could you please share the Python File in your Github Repo?

I have a working Flask program that can accept the XML in the post and log it to console, but have not yet taken it any further. When I tried this with NodeJS, I was only getting about half of the XML file converted and reading online, it looks like Python is the better way to go, and since I am trying to learn Python, I figured I would give it a go. Basically, it would be taking an XML API Post and converting it to JSON. Thanks again

darylkupper
Автор

This worked well for me fam... Thank you!

damoimyers
Автор

This is not working. I am getting the following every time I try to run it and I have tried several edits:

File "XMLToJSONtest.py", line 21
except Exception as e:
^
SyntaxError: invalid syntax

And if I comment out the except statement, I get the following errors when I try to run it:

Traceback (most recent call last):
File "XMLToJSONtest.py", line 15, in <module>
tree = ET.parse (f)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1182, in parse
tree.parse(source, parser)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 656, in parse
parser.feed(data)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1659, in feed
self._raiseerror(v)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1523, in _raiseerror
raise err
syntax error: line 1, column 0

And if I try to run it in Python3, I get the following errors:

python3 XMLToJSONtest.py
File "XMLToJSONtest.py", line 14
for f in glob.glob ("files/*.{}" .format (type)):
^
TabError: inconsistent use of tabs and spaces in indentation

darylkupper
Автор

Thanks a lot. Can you share the python file?

KhalilYasser
visit shbcf.ru