I have written C/C++ code for many years but recently I took an interest in Python. I have been working through the problems at projecteuler.net and have started to get a good feel for the language (but still have to make a conscious effort not to put ;'s at the end of every line.)
Problem 81 requires reading a text file containing an 80x80 matrix. My code works file, but I have a feeling there is a much better and/or more elegant way of handling this part of the problem. Any comments from a more experienced Python coder would be greatly appreciated.
The relevant portion of the code:
infile = open('matrix.txt') line = infile.readline() y =  for line in infile: a = 0 b = 0 x =  for it in line: b = b + 1 if it == ',': x.append(int(line[a:b-1])) a = b x.append(int(line[a:])) y.append(x) infile.close()
Thank you in advance.