zoukankan      html  css  js  c++  java
  • Python读写Excel文件和正则表达式

    Python 读写Excel文件

    这里使用的是 xlwtxlrd 这两个excel读写库。

    #_*_ coding:utf-8 _*_
    #__author__='观海云不远'
    #__date__ = '2019-07-11'
    #读写excel
    
    import xlwt
    import xlrd
    import re
    
    workbook = xlrd.open_workbook('data.xlsx')
    sheet = workbook.sheet_by_index(0)
    
    data = []
    
    for rx in range(0, sheet.nrows):
        row = sheet.row(rx)
        item = []
        for cx in row:
            item.append(cx)
        data.append(item)
    
    workbook = xlwt.Workbook()
    sheet = workbook.add_sheet('output')
    
    rIndex = 0
    for row in iter(data):
        cIndex = 0
        for cel in row:
            sheet.write(rIndex, cIndex, cel.value + " changed")
            cIndex += 1
        rIndex += 1
    
    workbook.save('data_output_1.xls')
    

    Python 正则表达式

    查找val中是否存在xxx

    import re
    ret = bool(re.search(r'xxx', val))
    
  • 相关阅读:
    鼠标和滚轮事件
    UI事件
    跨浏览器的事件对象
    DOM中的事件对象和IE事件对象
    Monolog手册参考
    nginx 配置
    es elasticsearch-head安装
    es ik分词插件安装
    yii2.0+es
    php分词工具scws
  • 原文地址:https://www.cnblogs.com/lurenjiashuo/p/python-read-write-excel-regex.html
Copyright © 2011-2022 走看看