Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can i parse my output?
#14
Because your data is still a list. You need to get the content from the list and this is your dict.
The for-loop ist nested with a second for-loop.

In my example, I do the following:
  • open the file
  • iterate over lines (3 in total) [first level of iteration]
  • parse with literal_eval the single line, which results into a list.
  • iterate over the list (from literal_eval) to get the list elements [second level of iteration]
  • update the result dict, with the elements (dicts) from the list (result =| element)
  • process the IPAddress to correct this entry

BTW: if you save the data in the right format, all these steps are not required. Look at the answer above,
ilknurg likes this post
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
How can i parse my output? - by ilknurg - Mar-10-2022, 10:30 AM
RE: How can i parse my output? - by Gribouillis - Mar-10-2022, 10:42 AM
RE: How can i parse my output? - by ilknurg - Mar-10-2022, 10:47 AM
RE: How can i parse my output? - by DeaD_EyE - Mar-10-2022, 10:58 AM
RE: How can i parse my output? - by Gribouillis - Mar-10-2022, 11:02 AM
RE: How can i parse my output? - by ilknurg - Mar-10-2022, 11:09 AM
RE: How can i parse my output? - by DeaD_EyE - Mar-10-2022, 12:00 PM
RE: How can i parse my output? - by ilknurg - Mar-10-2022, 12:15 PM
RE: How can i parse my output? - by DeaD_EyE - Mar-10-2022, 12:24 PM
RE: How can i parse my output? - by ilknurg - Mar-10-2022, 12:35 PM
RE: How can i parse my output? - by menator01 - Mar-10-2022, 12:29 PM
RE: How can i parse my output? - by ilknurg - Mar-10-2022, 12:39 PM
RE: How can i parse my output? - by snippsat - Mar-10-2022, 12:41 PM
RE: How can i parse my output? - by ilknurg - Mar-10-2022, 01:07 PM
RE: How can i parse my output? - by DeaD_EyE - Mar-10-2022, 12:50 PM
RE: How can i parse my output? - by snippsat - Mar-10-2022, 01:43 PM
RE: How can i parse my output? - by ilknurg - Mar-10-2022, 01:51 PM
RE: How can i parse my output? - by menator01 - Mar-10-2022, 02:08 PM
RE: How can i parse my output? - by ilknurg - Mar-10-2022, 02:19 PM
RE: How can i parse my output? - by snippsat - Mar-10-2022, 02:16 PM
RE: How can i parse my output? - by Gribouillis - Mar-10-2022, 02:17 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can i parse my output? ilknurg 4 1,626 Mar-16-2022, 03:27 PM
Last Post: snippsat
  Unable to parse JSON output dragan979 1 3,585 Apr-20-2018, 02:24 PM
Last Post: dragan979

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020