On 22 June 2013 14:36, Joshua Landau <joshua.landau...@gmail.com> wrote: > My favourite way would be along the lines of: > > message = "Item wrote to MongoDB database " > message += "{0[MONGODB_DB]}/{0[MONGODB_COLLECTION]}".format(settings) > log.msg(message, level=log.DEBUG, spider=spider)
To make a habit of replying to myself, I thought I'd point out I wrote it this way mostly because I have no idea how big "settings" is. If it's not large and only contains keys that are valid identifiers, it'd be more readable to write: message = "Item wrote to MongoDB database " message += "{MONGODB_DB}/{MONGODB_COLLECTION}".format(**settings) log.msg(message, level=log.DEBUG, spider=spider) -- http://mail.python.org/mailman/listinfo/python-list