I'm running a program that reads a Dictionary off a file called questions.txt
.
{
1:{0:'question',1:{1:'answer1a',2:'answer1b'},2:'answer2'},
2:{0:'question',1:'answer1',2:'answer2'},
3:{0:'question',1:'answer1',2:'answer2'},
4:{0:'question',1:'answer1',2:'answer2'}
}
I'm using this code from my file dictict.pyw
to read parts of the Dictionary.
fQDict = open("questions.txt", "r")
QDict = " "
for i in fQDict.read().split():
QDict += i
fQDict.close()
QDict = eval(QDict)
print(QDict)
print(QDict[1])
print(QDict[1][0])
print(QDict[1][1])
print(QDict[1][1][1])
When I run the program python throws an error saying source code string cannot contain null bytes
at the QDict = eval(QDict)
line, why?