# L-17 MCS 260 Fri 19 Feb 2010 : bkfrom2list # converts existing formats of books as # # 1:1:Computer Science. An Overview: # 0:2:Python Programming in Context: # # into # # [True, 1, 'Computer Science. An Overview'] # [False, 2, 'Python Programming in Context'] infile = open('books','r') outfile = open('bookslists','w') while True: s = infile.readline() if s == '': break L = s.split(':') t = [L[0] == '1',int(L[1]), L[2]] outfile.write(str(t) + '\n') infile.close() outfile.close()