鱼C论坛

 找回密码
 立即注册
查看: 2271|回复: 2

在进行调试的时候,while处有个语法错误。无法理解,请指教

[复制链接]
发表于 2017-11-9 00:26:13 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
本帖最后由 康小泡 于 2017-11-9 11:14 编辑
  1. def student_information_write(num):    #建立学生信息
  2.     row=0                   #行数
  3.     col=0                   #列数
  4.     num=int(num)
  5.     if os.path.isfile(Path+"/information.xls"):
  6.         information_excel=xlrd.open_workbook(Path+"/information.xls",encoding="utf-8")#如果文件存在打开表格
  7.         information_sheet=information_excel.sheet_by_name("information")        
  8.     else:
  9.         information_excel=xlwt.orkbook(Path+"/information.xls")#如果文件,不存在新建表格
  10.         information_sheet=information_excel.add_sheet("information")#建立信息sheet
  11.         information_sheet.write(0,0,unicode("student name","utf-8"))# 存放学生姓名信息
  12.         information_sheet.write(0,1,unicode("student age","utf-8"))# 存放学生成绩信息
  13.         information_sheet.write(0,2,unicode("student score","utf-8")#存放学生年龄信息
  14.                                 
  15.     while(num!=0):
  16.         name=name_list()
  17.         age=age_list()
  18.         score=score_list()
  19.         information_sheet.write(row+1,col,unicode(name,"utf-8"))# 写入名字
  20.         information_sheet.write(row+1,col+1,unicode(age,"utf-8"))#写入年龄
  21.         information_sheet.write(row+1,col+2,unicode(score,"utf-8"))#写入成绩
  22.         row+=1
  23.         num-=1
  24.                                 
  25.     information_excel.close()
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2017-11-9 07:02:32 From FishC Mobile | 显示全部楼层
目测是缩进问题
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2017-11-9 07:16:32 | 显示全部楼层
        information_sheet.write(0,2,unicode("student score","utf-8"))#存放学生年龄信息
                                
    while(num!=0):
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-12-25 19:26

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表