How can I pass configuration variable values into the pyodbc connect command?

Other options for the connect function:

# using keywords for SQL Server authentication
self.db = pyodbc.connect(driver=driver, server=server, database=db,
                         user=user, password=password)

# using keywords for Windows authentication
self.db = pyodbc.connect(driver=driver, server=server, database=db,
                         trusted_connection='yes')    

self.db = pyodbc.connect('driver={%s};server=%s;database=%s;uid=%s;pwd=%s' % ( driver, server, db, user, password ) )

%s is used to include variables into the string

the variables are placed into the string according to their order after the %