Hi Guys,

When python reads in a file, can lines be referred to via an index?

Example:

for line in file:
     if line[0] == '0':
         a.write(line)

This works, however, I am unsure if line[0] refers only to the first line or
the first character in all lines.

Is there an easy way to refer to a line with the first character being a
single letter that you know?

Thanks in advance,
Seafoid.
-- 
View this message in context: 
http://old.nabble.com/Line-indexing-in-Python-tp26845253p26845253.html
Sent from the Python - python-list mailing list archive at Nabble.com.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to