Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 How to write to csv file
#1
Hi,
I read some data from the web which is in the below format:

[{'expTime":"2019\/04\/02 00:11:23","type_exp" :"INJ_2026","F_pair":148,"end_count":3,"rank":96},{'expTime":"2019\/04\/05 13:20:12,"type_exp" :"INJ_2056","F_pair":48,"end_count":8,"rank":36},{'expTime":"2019\/04\/12 20:13:23","type_exp" :"INJ_2045","F_pair":68,"end_count":2,"rank":66}]

Now I want to write it to CSV file as below:

expTime               type_exp   F_pair end_count rank
2019/04/02 00:11:23   INJ_2026     148    3         96
2019/04/05 13:20:12   INJ_2056     48     8         36
2019/04/12 20:13:23   INJ_2045     68     2         66
Please help someone,
Quote
#2
check csv module and in particular csv.DictWriter
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Write SQLite query result to file hjk6734 1 60 May-27-2020, 12:17 PM
Last Post: menator01
  Append JSON's and write to file faqsap 4 172 May-15-2020, 04:20 PM
Last Post: faqsap
  Print/write to file function tpolim008 4 216 Apr-01-2020, 07:59 PM
Last Post: tpolim008
  Write object to file medatib531 7 228 Apr-01-2020, 06:25 PM
Last Post: BrendanD
  Replace XML tag and write to the same file krish216 4 274 Mar-26-2020, 07:39 AM
Last Post: snippsat
  can we write command output to new csv file using Panda package? PythonBeginner_2020 3 328 Mar-13-2020, 12:38 PM
Last Post: ndc85430
  What mode should i open the file to write into a *.msh file Dhanya 0 298 Jan-09-2020, 08:27 AM
Last Post: Dhanya
  how to write messages from command window to log file SriRajesh 1 358 Dec-25-2019, 03:57 PM
Last Post: ibreeden
  Write the XML file from elementtree with hexa decimal encoding Dillibabu 4 276 Dec-24-2019, 10:10 AM
Last Post: Dillibabu
  write an integer to file using a function xvkxvo 4 387 Dec-10-2019, 11:27 PM
Last Post: xvkxvo

Forum Jump:


Users browsing this thread: 1 Guest(s)