Lonnie Princehouse wrote:
Might as well make a class for Book instead of dealing with buckets of
lists...

class Book(object):
    def __init__(self, title, author, publisher, isbn, date):    # add
more fields according to CSV
        self.__dict__.update(locals())  # lazy!

Just for any newbies not paying attention, a slightly less lazy approach that doesn't leave the Book instance referencing itself would do something like:


    params = locals()
    del params['self']
    self.__dict__.update(params)

or just write it out:

    self.title = title
    self.author = author
    self.publisher = publisher
    self.isbn = isbn
    self.date = date

=)

STeVe
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to