PYTHON 连接SQL2000
import pyodbc import pandas as pd conn = pyodbc.connect('DRIVER={SQL Server};SERVER=127.0.0.1;DATABASE=Easybook;UID=sa;PWD=') cursor = conn.cursor() cursor.execute('select * from Bookclass') df=pd.read_excel("jieguo1.xls") for index,row in df.iterrows(): a1=row["Bcid"] a2=row["Bid"] a3=row["EnterDate"] a4=row["price"] for row in cursor: print(row)