[SOLVED] Python - pass variable as parameter?
by czezz from LinuxQuestions.org on (#5HJF1)
In python, how can I pass variable as a parameter eg. in db connector?
In this example im trying set host as what is defined in: dbhost variable but it does not work. I tried also $dbhost , "dbhost" , '(dbhost)'... and more. None works.
Code:dbhost="10.1.1.19"
print(dbhost)
connection_parameters = "dbname=db_lab user=lab_user password=123 host=(dbhost) port=5432"


In this example im trying set host as what is defined in: dbhost variable but it does not work. I tried also $dbhost , "dbhost" , '(dbhost)'... and more. None works.
Code:dbhost="10.1.1.19"
print(dbhost)
connection_parameters = "dbname=db_lab user=lab_user password=123 host=(dbhost) port=5432"