On Wed, 18 Jul 2012, Jonathan Karon wrote:

   if not len(line.strip()): continue # ignore blank lines

  Ah, that does make sense. Didn't think of that.

" f.readline() reads a single line from the file; a newline character (\n)
is left at the end of the string "

The last element of your chems list will still contain that trailing
linefeed. Try this when initially loading the chems list:

chems = [c.strip() for c in infile.readline().split(',')]

  That did the trick.

  Thank you both, Jonathan and Ethan, for the lessons.

Much appreciated,

Rich


_______________________________________________
Portland mailing list
[email protected]
http://mail.python.org/mailman/listinfo/portland

Reply via email to