There 's a indentation error but i don't know what's wrong with it.
the error says
File "./class_question. py", line 12
self.dic = [] #array of hash tables for input data
^
IndentationErro r: expected an indented block
the error says
File "./class_question. py", line 12
self.dic = [] #array of hash tables for input data
^
IndentationErro r: expected an indented block
Code:
#! /usr/bin/env python
class Question:
#constructor
dic
questions
answers
qANDa
vspace
def __init__(self):
self.dic = [] #array of hash tables for input data
self.questions = [] #array for all questions
self.answers = [] #array for corresponding answers
self.qANDa = [] #array of hash tables
self.vspace = "0.4in "
def getRestrictions(self,filename):
print "Processing",filename
def addquestion(self,questionstring):
self.questions.append(questionstring)
def addanswer(self,answerstring):
self.answers.append(answerstring)
def addqANDa(self,questionstring, answerstring):
dictionary = {}
dictionary['question'] = questionstring
dictionary['answer'] = answerstring
self.qANDa.append(dictionary)
def outputdata(filename):
questionfilename = "files/"+filename +"_questions.tex"
answerfilename = "files/"+filename +"_answers.tex"
questionFile = open(questionfilename, "w")
answerFile = open(answerfilename, "w")
for ques in self.questions:
questionFile.write(ques+"\n")
questionFile.write("\\vspace{"+self.vspace+"}")
for answ in self.answers:
answerFile.write(answ)
questionFile.close();
answerFile.close();
Comment