Support Forums

Full Version: Replacement of the code given below
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
#!/usr/bin/env python
import csv

list = []
x = open("file.txt")
with x as csv_data:
    entries = csv.reader(csv_data, delimiter=",")
    for entry in entries:
         list.append({
             "name": entry[0],
             "type": entry[1],
             "link": entry[2],
             "level": entry[3]
         })

The above code is working fine, but it is not working inside gdb prompt. There is some issue with the keyword 'with' and 'as' support inside gdb. So can the same task be completed(what above code is doing) in an alternative way which does not use both keyword.
In file file.txt, the contents are following:
Mac, char, list, one
John, char, list, three
...
...