Hey,
here is a snip of my code.

#logger code----------------------------------------------
                #  first new line
                #self.logfile.write('\n')
                #  date and time
                #self.logfile.write('%s,'%(str(strftime("%Y-%m-%d %H:%M:%S", 
gmtime()))))
                #  blah = [time, 'nac', 'tgid', 'source', 'dest', 'algid'] is 
what we want
                tmplist = []
                tmplist.append(str(strftime("%Y-%m-%d %H:%M:%S", localtime())))
                tmplist.append(field_values["nac"])
                tmplist.append(field_values["tgid"])
                tmplist.append(field_values["source"])
                tmplist.append(field_values["dest"])
                tmplist.append(field_values["algid"])

        #this prints the current row of data to the terminal
        #print tmplist

        # this prints the current row of data to the csv file
                for item in tmplist:
                        self.logfile.write('%s,' % (str(item)))
                self.logfile.write('\n')


        #  loop through each of the TextCtrl objects
        #for k,v in self.fields.items():
            #  get the value of the current TextCtrl field
           # f = field_values.get(k, None)
            #if f:
            # check if k is the field you want
                #  output the value with trailing comma
                #self.logfile.write('%s,'%(str(f)))
        # self.logfile.write('\n') # here is where you would put it
        #end logger code-------------------------------

i know its ugly.  but there is two ways to log here.  one makes a list
(current) and the other (commented out) loops through the TextCtrls and
writes.  is their a better way than what i have here? the TextCtrl
fields get their values from a pickle.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to