def _prt_line_detail ( self , prt , line , lnum = "" ) : data = zip ( self . flds , line . split ( '\t' ) ) txt = [ "{:2}) {:13} {}" . format ( i , hdr , val ) for i , ( hdr , val ) in enumerate ( data ) ] prt . write ( "{LNUM}\n{TXT}\n" . format ( LNUM = lnum , TXT = '\n' . join ( txt ) ) )
how to print fields of a line in python
Print each field and its value .
def _prt_line_detail(self, prt, line, lnum=""):
        """Print each field and its value."""
        data = zip(self.flds, line.split('\t'))
        txt = ["{:2}) {:13} {}".format(i, hdr, val) for i, (hdr, val) in enumerate(data)]
        prt.write("{LNUM}\n{TXT}\n".format(LNUM=lnum, TXT='\n'.join(txt)))