利用xlwt为什么前面50行没写进去EXCEL,代码也没报错,后面的30行却写进去了
if st == 'Start-Line' and pc == '+':print("该路线已平差")
wb = xlwt.Workbook()
ws = wb.add_sheet("高程值")
ws.write(0,0,"点号")
ws.write(0,1,"高程")
elif st == 'Start-Line' and pc != '+':
break
print("该路线未平差")
ptN = line[20:29].strip() # 点号
z = line[95:97].strip() # 高程符号
h = line[100:113].strip() # 高程值
wy = line[29:35].strip() # 看这一行是否有错误,有的话就无用了
js = line[49:51] # 看是不是路线结束行
if z == 'Z' and wy != '#####' and (js != 'Sh' and js != 'Db'):
print("可以提取高程了")
if ptN.isdigit() and ptN != 'TP': # 如果点号全为数字或者TP,则为转点,不提取高程
continue
else:
print("输出到EXCEL中")
ws.write(r,0,ptN)
ws.write(r,1,h)
print(r,ptN, h)
r += 1
为什么前面50行没写进去EXCEL,代码也没报错,后面的30行写进去了