How to update json file with python

This is the place for queries that don't fit in any of the other categories.

How to update json file with python

Postby tbaror » Tue Aug 20, 2013 7:13 pm

Hello All,

I have python utility i wrote that doing some WMI monitoring, the the data is written in that format


Code: Select all
CPU = [{'TS':'2013:12:03:30','CPUVALUES':['0','1','15']}]

Now i need occasionally update data that will look eventually like following

Code: Select all
 CPU = [{'TS':'2013:12:03:30','CPUVALUES':['0','1','15']},{'TS':'2013:14:00:30','CPUVALUES':['0','75','15']}]

Any suggestion how to accomplish that
Please advice
Posts: 19
Joined: Sun Jul 07, 2013 8:06 pm

Re: How to update json file with python

Postby micseydel » Tue Aug 20, 2013 9:10 pm

If you don't mind having double instead of single quotes, the builtin json module rocks.

If you want more help than us saying what the name of a module, I recommend you post some code attempt at solving your problem and ask as specific of questions as you want answers.
Due to the reasons discussed here we will be moving to on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Posts: 3000
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 6 guests