# L-22 MCS 260 Wed 17 Oct 2007 : bkfrom2list # # converts existing formats of books as # # 1:1:The Art & Craft of Computing: # 0:2:Making Use of Python: # # into # # [True, 1, 'The Art & Craft of Computing'] # [False, 2, 'Making Use of Python'] # 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()