Python get selected text
How would I, using Python "catch" text that a user has selecting in, for example, a web browser? The script would idle 开发者_高级运维in the background, and when a certain key combination is pressed, it "gets" the text the user has selected. Think copy & paste, only it copies to my application instead of a clipboard.
Thanks! I'd like to point out that this will be for Mac.
Install
xselsudo apt-get install xclip xsel -ySave this as
get-selected.pyimport os print(os.popen('xsel').read())Select text
Run
python get-selected.py
加载中,请稍侯......
精彩评论