0

I'm using Python 3.10 and I'm writing code that requires writing its output to the clipboard, and I don't want to download external libraries because I think it would be a hassle and I have no clue when I will ever use the library next. It doesn't have to output text to the clipboard, but I think it would be more convenient if it did.

I've tried searching it up but it has only showed me how to do it using external libraries, or not answering the question, and I'm beginning to doubt whether it is even possible. I've seen and used code that finds what is currently in your clipboard without use of external libraries (here), so I would assume it is also possible with copying text to the clipboard.

  • Honestly, your solution is OS dependent that you've shown. Unless you are building a console or GUI python this is not how you should do this. It should be JS as it is native there – ViaTech Jan 16 '23 at 21:07
  • I closed this question because it is a duplicate, but if you're going to do this, realise that you'll now have to get it to work for all operating systems and versions of Python you need to run your script on. Windows versions, older versions of Python, 32-bit and 64-bit, etc. It's a bad idea, you are much better off downloading a small library that has all of this done already. – Grismar Jan 16 '23 at 21:09
  • @ViaTech it should be "JS", as in JavaScript? How is anything in a scripting language built for web interfaces more native than something like Python. Did you mean to say that JavaScript has support for clipboard interaction built in to the standard libraries? And that Python should too, or are you suggesting someone switch their entire language simply because a single functionality is not natively available in the language itself? – Grismar Jan 16 '23 at 21:12

0 Answers0