아래 코드는 python 코드 (gdb 모듈 제외)로 잘 작동하지만 gdb에서 작동하지 않습니까?gdb-python : 왜 아래 코드가 gdb에서 작동하지 않습니까?
#!/usr/bin/env python
import csv
import gdb
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]
})
오류는 다음과 같습니다
(gdb) source script.py
File "script.py", line 6
with x as csv_data:
^
SyntaxError: invalid syntax
file.txt를은 다음과 같습니다
Mac, char, list, one
John, char, list, three
...
...
이 with
와 as
키워드에 문제가있는 것 같다.
누구든지 회신 해 주실 수 있습니까? –