| # -*- coding: GBK -*-  | 
| #¶ÁÈ¡Excel±£´æµÄÅäÖÃÎļþµÄ±ãÀû·â×°À࣬¿ÉÒÔÉèÖúöÂÔµÄÐкÍÁеÄÊýÁ¿  | 
| # author: Alee  | 
| # Date: 2011.9.1  | 
| # history:  2011.9.1     Created  | 
|   | 
|   | 
| import logging  | 
| import traceback  | 
|   | 
| class DataFileReader(object):  | 
|     _SKIP_LINES = 1  | 
|     _SKIP_COLUMNS = 1  | 
|     def __init__( self ):  | 
|         pass  | 
|   | 
|     def _ProcessData( self, datalist ):  | 
|         pass  | 
|   | 
|     def _ProcessLine( self, line ):  | 
|         new = line.replace( "\n", "\t" )  | 
|         e = new.split( "\t" )  | 
|         skip = self._SKIP_COLUMNS  | 
|         self._ProcessData( e[skip:] )  | 
|   | 
|     def Open( self, filename ):  | 
|         try:  | 
|             fp = open( filename )  | 
|         except Exception, e:  | 
|             print str(e)  | 
|             print traceback.print_exc()  | 
|             logging.error( str(e) )  | 
|             logging.error( traceback.print_exc() )  | 
|             return False  | 
|   | 
|         skip = self._SKIP_LINES  | 
|         for line in fp:  | 
|             if 0 == skip:  | 
|                 self._ProcessLine( line )  | 
|             else:  | 
|                 skip -= 1  | 
|                 continue  | 
|         return True  |