Article 5HJF1 [SOLVED] Python - pass variable as parameter?

[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"latest?d=yIl2AUoC8zA latest?i=kTKks7j9frU:B8TlYlXVwDw:F7zBnMy latest?i=kTKks7j9frU:B8TlYlXVwDw:V_sGLiP latest?d=qj6IDK7rITs latest?i=kTKks7j9frU:B8TlYlXVwDw:gIN9vFwkTKks7j9frU
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments