import pandas as pd
#读取excel
df = pd.read_excel("用户-模板.xlsx");
print("len(df):",len(df))
for i in range(len(df)):
data ={}
data["姓名"] = df['姓名'][i]
data["年龄"]=df["年龄"][i]
data["性别"]=df["性别"][i]
data["手机号"]=df["手机号"][i]
data["id"]=df["id"][i] print(data)
if __name__ == '__main__':
pass
首次使用报错:ImportError: Missing optional dependency 'openpyxl'. Use pip or conda to install openpyxl. 首次使用python需要,安装pandas和openpyxl模块和依赖 pip install pandas pip install openpyxl |