Right I'm having a spot of trouble with integer and string values when reading from a '.txt' file.
The aim is for the programme to read in from a file containing code similar to this...
A;Ed;Young;e.yo ung@msn.com;223 376;1;0;1;0
When running I receive this error code...
I would insert the full code but its 226 lines long. If anyone can see the answer from the run script it would be much appreciated.
The aim is for the programme to read in from a file containing code similar to this...
A;Ed;Young;e.yo ung@msn.com;223 376;1;0;1;0
When running I receive this error code...
Code:
TypeError Traceback (most recent call last)
C:\Users\Anon\Programming Coursework Semester 2... 11-05-2010\eg3.py in <module>()
222
223 app = QApplication(sys.argv)
--> 224 form = MemberListDlg(members)
225 form.show()
226 app.exec_()
C:\Users\Anon\Programming Coursework Semester 2... 11-05-2010\eg3.py in __init__(self,
memberList)
53 self.listWidget.setFont(font)
54 for m in memberList: # Initialise the QListWidget
---> 55 self.listWidget.addItem(m.string())
56
57 # Initialise the buttons and lay them out in a vertical column
39 '''Return string of members'''
---> 40 m = "%-2s %-16s %-16s %-16s %-16d %-16d %-16d %-16d %-16d" % (self.i_d,self.forename,self.surname,self.email,self.phone,division_current[self.division_current],self.points_current,division_previous[self.division_previous],self.points_previous)
41 return m
42
TypeError: list indices must be integers, not str
WARNING: Failure executing file: <eg3.py>
Comment