如何在不输入真实密码的情况下在连接详细信息中引用密码?
PWD = '1234'
try:
con = psycopg2.connect("dbname = 'testdb' user = 'testuser' host =
'localhost' password = pwd")
except:
print ('I am unable to connect the database')
这不允许我连接,但以下内容将
:try:
con = psycopg2.connect("dbname = 'testdb' user = 'testuser' host =
'localhost' password = '1234'")
except:
print ('I am unable to connect the database')