推荐学习书目
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
larkifly
V2EX  ›  Python

os x 环境下, python 如何获取到剪切板的内容?

  •  
  •   larkifly · Jan 11, 2016 · 4614 views
    This topic created in 3798 days ago, the information mentioned may be changed or developed.
    9 replies    2016-01-11 20:07:27 +08:00
    aisk
        1
    aisk  
       Jan 11, 2016   ❤️ 1
    可以尝试调用命令行的 pbpaste ,其他方案就不清楚了。
    kfll
        2
    kfll  
       Jan 11, 2016   ❤️ 1
    调子进程 pbpaste
    ClericPy
        3
    ClericPy  
       Jan 11, 2016   ❤️ 1
    pyperclip
    myth
        4
    myth  
    PRO
       Jan 11, 2016   ❤️ 1
    PySide or PyQt4

    QtGui.QApplication.clipboard()
    Elethom
        5
    Elethom  
       Jan 11, 2016   ❤️ 2
    兩種方式:
    * 開 subprocess 讀 pbpaste 的 stdout ,同理用 pbcopy 可以寫入 clipboard ;
    * PyObjC 直接 call NSPasteboard 的 API 。
    aec4d
        6
    aec4d  
       Jan 11, 2016
    如果只是要获取粘贴板里面的字符串 那么 python 有很多库可以做(底层都是对 pbpaste 的封装)
    如果是要获取粘贴板里面的图片 可以用 pngpaste
    我写过一个上传粘贴板图片的脚本
    https://gist.github.com/Ficapy/8c57998d14c434ab5df3
    vanxining
        7
    vanxining  
       Jan 11, 2016 via Android
    pip install clipboard
    FradSer
        8
    FradSer  
       Jan 11, 2016
    @Elethom 谢谢爱酱
    cxbig
        9
    cxbig  
       Jan 11, 2016
    学用命令行的 pbcopy 和 pbpaste
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   888 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 21:12 · PVG 05:12 · LAX 14:12 · JFK 17:12
    ♥ Do have faith in what you're doing.