Exemple #1
0
 def LoadFromXmlRow(self, xmlRow):
     c = Company()
     dataVal = xmlRow.findAll('td')
     for i in xrange(len(dataVal)):
         if i < len(classKey) and classKey[i] != '':
             c.__dict__[classKey[i]] = dataVal[i].text
     return c   
Exemple #2
0
 def LoadFromPlainTxt(self):
     txtFile = open(SHENZHEN_COMPANY_INFO, 'r')
     fieldLine = txtFile.readline()
     fieldCnVals = fieldLine.split(':')
     
     dataLine = txtFile.readline()
     companys = {}
     while dataLine:
         c = Company()
         dataVals = dataLine.split(':')
         for i in xrange(len(dataVals)):
             c.__dict__[classKey[i]] = dataVals[i]
         dataLine = txtFile.readline()
         c.ticker = c.code + '.SZ'
         companys[c.ticker] = c
     txtFile.close()
     return companys