Hi
I am having problems using the readline command, I get an alarm
lineA = fin.readline[lpa].strip() # Read line indicated by pointer a and delete CR
TypeError: 'builtin_function_or_method' object is unsubscriptable
when trying to run this code
I tried removing the strip component and that didnt help. Some help would be much appreciated
fin = open ("origDict.txt", "r")
fout = open ("newDict.txt", "w")
lif = 0 # Lines in original file
lpp = 72 # Lines per page. Default value, look at user selection later
lpa = 1 # Line pointer a
lpb = lpp # Line pointer b. This is effectively the offset.
pc = 1 # Pages completed. Incremented each time
linelist = fin.readlines() # Reads the origDict.txt file as a list of lines
lif = len(linelist)
print lif
while lpa != (lpp * pc ): # Loop until 1st page is complete
lineA = fin.readline[lpa].strip() # Read line indicated by pointer a and delete CR
lineB = fin.readline[lpb] # Read line indicated by pointer b
newString = "%s\t%s" % (lineA, lineB)
fout.write (newString) # write string to newDict
print newString