create/access dynamic growth list

sam sam.wun at authtec.com
Thu Mar 17 23:45:12 EST 2005


Hi,

I have a configuration file need to be processed (read/write) by python.
Currently I the following method can only read and store data that 
python read a line from a configuraiton file:
  def _parse (self):
         # parse message
         m = self.FWShow_Command.match (conf_data)
         if (m == None):
             raise FW_Command.Error ("corrupt macro definition")

         # store generic data
         macro = {}
         macro["key"] = m.group (1)
         macro["value"] = m.group (2)

         return (conf_data, macro)

Since there are unknown number of lines in a configuration file, I want 
to store the array of "macro" in a list.
How can I do that in Python?

Thanks
Sam.



More information about the Python-list mailing list