方法一:
import cx_Oracle
host = "host"
account = "account"
password = "password"
service_name = "service_name"
connect = cx_Oracle.connect(account + r'/' + password + '@' + host + r'/' + service_name, encoding="UTF-8")
方法二:
import cx_Oracle
host = "host"
account = "account"
password = "password"
service_name = "service_name"
tns = cx_Oracle.makedsn(host, 1521, service_name)
connect = cx_Oracle.connect(account, password, tns, encoding="UTF-8")