标题:利用xlwt为什么前面50行没写进去EXCEL,代码也没报错,后面的30行却写进去了 ...
取消只看楼主
fxyxl
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2021-12-14
 问题点数:0 回复次数:0 
利用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行写进去了
搜索更多相关主题的帖子: line print EXCEL and strip 
2021-12-14 15:43



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-507868-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.232490 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved