Hi all, I have something like this: def dbconn(): #Establishes connection to local db try: conn = client() db = conn.db_solar #dbname collection = db.main # dbcollection / Table print "Connected to database successfully!!!" return(db,collection) except errors.ConnectionFailure, e: print "Could not connect to MongoDB: %s" % e sys.exit()
Now I want to remove the hardcoded 'db_solar' and 'main' (from db.main) and load these values from a config file. Once I have loaded in a string 'db_solar' from a config file how do I use it such that something like db=conn.db_solar will be constructed and run as expected. Thanks -- https://mail.python.org/mailman/listinfo/python-list