John Salerno <[EMAIL PROTECTED]> writes: > Interesting. So I would say: > > [line.rstrip() for line in open('C:\\switches.txt')]
Yes, you could do that. Note that it builds up an in-memory list of all those lines, instead of processing the file one line at a time. If the file is very large, that might be a problem. If you use parentheses instead: (line.rstrip() for line in open('C:\\switches.txt')) you get what's called a generator expression that you can loop through, but that's a bit complicated to explain, it's probably better to get used to other parts of Python before worrying about that. -- http://mail.python.org/mailman/listinfo/python-list