Python3 操作excel读写报错 AttributeError: 'Book' object has no attribute 'save'(write,value)

Python3 对excel进行读取操作,读取完不需要save;有写入操作才需要save

1.看如下脚本:

#!/usr/bin/env python3
#coding=utf-8

import datetime,platform,time,os,sys,stat,re,linecache
from urllib import request
import urllib.request
import shutil,xlrd,xlwt,openpyxl
from xlutils.copy import copy
#from openpyxl import load_workbook
wbb=xlrd.open_workbook(r’Top_500_of_PE_result.xls’)
#wbb1=copy(wbb)
wss=wbb.sheet_by_index(0)
print(wss.name,wss.nrows,wss.ncols)
wbb.save(“Top_500_of_PE_result.xls”)
运行结果如下:

RESTART: C:\3.Work\0.study\4.Python\201906\201906_auto_find_top500\20190628\python_xlsx20190628.py
PE_foundation_value 14 5
Traceback (most recent call last):
File “C:\3.Work\0.study\4.Python\201906\201906_auto_find_top500\20190628\python_xlsx20190628.py”, line 15, in
wbb.save(“Top_500_of_PE_result1.xls”)
AttributeError: ‘Book’ object has no attribute ‘save’
因为使用了xlrd模块操作,所以并不需要save,否则,会报错。同样在这里使用write也会有同样报错!!!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值