changeset 2:c6c0578924fa

Skips the header line (only counts data records)
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 05 Feb 2013 16:21:43 +0000
parents d6b2e34ab8c0
children 8a8bccdf4e9c
files python-intro.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/python-intro.py	Tue Feb 05 16:19:56 2013 +0000
+++ b/python-intro.py	Tue Feb 05 16:21:43 2013 +0000
@@ -1,4 +1,8 @@
 source = open('data.txt', 'r')
+
+# reads header line
+source.readline()
+
 number = 0
 
 # count number of data records
@@ -6,4 +10,4 @@
     number = number + 1
 source.close()
 
-print "Total number of lines:", number
+print "Total number of data records:", number