|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
stu = pandas.read_excel(filename) #读取excel文件
modifyId = queryById() #通过id查询到对应的行
if modifyId:
stuName,stuSex,stuAge,chinese,maths,english = input_sut()
stu.loc[modifyId[0],'姓名'] = stuName
stu.loc[modifyId[0],'性别'] = stuSex
stu.loc[modifyId[0],'年龄'] = stuAge
stu.loc[modifyId[0],'语文'] = chinese
stu.loc[modifyId[0],'数学'] = maths
stu.loc[modifyId[0],'英语'] = english
#print(modifyId)
stu.to_excel(filename,index=False)
print('修改成功!')
为什么我运行后,表里的原值没有修改,反而新插入了一行啊? |
|