V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
JCZ2MkKb5S8ZX9pq
V2EX  ›  Python

pandas 读取打开中的 excel

  •  
  •   JCZ2MkKb5S8ZX9pq · 2019-02-17 20:06:25 +08:00 · 2218 次点击
    这是一个创建于 1888 天前的主题,其中的信息可能已经有所发展或是发生改变。
    • 在 excel 里编辑一些内容
    • 不时地需要用 python 导出些东西
    • 用 pandas 直接读取开启中的 excel 会报错
      PermissionError: [Errno 13] Permission denied: 'sample.xlsx'
      
    • 关掉 excel 再跑就好了

    请问

    • 想把 excel 每次复制一份再读,但 shutil.copyfile 也同样会报错。
    • 有啥其它解法嘛?有经验的请不吝赐教,先谢谢了。
    2 条回复    2019-02-20 16:20:02 +08:00
    arrow8899
        1
    arrow8899  
       2019-02-18 10:06:45 +08:00
    用 shutil.copy
    JCZ2MkKb5S8ZX9pq
        2
    JCZ2MkKb5S8ZX9pq  
    OP
       2019-02-20 16:20:02 +08:00
    @arrow8899 shutil.copy 包含了 copyfile,好像是多复制了权限,一样会有 permission error。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2281 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 00:53 · PVG 08:53 · LAX 17:53 · JFK 20:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.