第一次遇到这个问题,Google后才找到解决方法(百度果然还是太弱了啊),编码的问题还是不熟
settings = {'CMT_SQLSERVER_DSN':'MerchantPrice','CMT_SQLSERVER_USERNAME':'readuser','CMT_SQLSERVER_PASSWD':'password'}
conn = "DSN=%s;UID=%s;PWD=%s" % (settings['CMT_SQLSERVER_DSN'], settings['CMT_SQLSERVER_USERNAME'], settings['CMT_SQLSERVER_PASSWD'])
db = pyodbc.connect(conn, unicode_results=True)