How do I copy a string to the clipboard on Windows using Python?

后端 未结 23 3153
温柔的废话
温柔的废话 2020-11-22 03:13

I\'m trying to make a basic Windows application that builds a string out of user input and then adds it to the clipboard. How do I copy a string to the clipboard using Pytho

23条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 03:42

    Here's the most easy and reliable way I found if you're okay depending on Pandas. However I don't think this is officially part of the Pandas API so it may break with future updates. It works as of 0.25.3

    from pandas.io import clipboard
    clipboard.copy("test")
    

提交回复
热议问题