added property "headerLen"

This commit is contained in:
Philip Eisenlohr 2012-01-18 09:30:50 +00:00
parent e6a3c0627b
commit aba4703463
1 changed files with 7 additions and 4 deletions

View File

@ -21,6 +21,7 @@ class ASCIItable():
'buffered':buffered, 'buffered':buffered,
'validReadSize': 0, 'validReadSize': 0,
} }
self.headerLen = 0
self.info = [] self.info = []
self.labels = [] self.labels = []
self.data = [] self.data = []
@ -54,11 +55,13 @@ class ASCIItable():
firstline = self.__IO__['in'].readline() firstline = self.__IO__['in'].readline()
m = re.search('(\d+)\s*head', firstline.lower()) m = re.search('(\d+)\s*head', firstline.lower())
if m: if m:
self.info = [self.__IO__['in'].readline().strip() for i in xrange(1,int(m.group(1)))] self.info = [self.__IO__['in'].readline().strip() for i in xrange(1,int(m.group(1)))]
self.labels = self.__IO__['in'].readline().split() self.labels = self.__IO__['in'].readline().split()
self.headerLen = int(m.group(1)) + 1
else: else:
self.info = [] self.info = []
self.labels = firstline.split() self.labels = firstline.split()
self.headerLen = 1
self.__IO__['validReadSize'] = len(self.labels) self.__IO__['validReadSize'] = len(self.labels)
def head_write(self): def head_write(self):