fname = raw_input("Enter file name: ") if len(fname) < 1 : fname = "mbox-short.txt" for line in fname: line = line.strip() if not line.startwith('From '): continue line = line.split() count = count + 1
You need to actually open the file. (Look up how to do that) The first 'for' loop is looping through the file NAME, not the file OBJECT. Also, line.startwith() should be line.startswith(). --john -- https://mail.python.org/mailman/listinfo/python-list