Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Replacement of the code given below
#1
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
...
...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)