擅长:python、mysql、java
<p>你试过这个吗?</p>
<pre><code>import os
def addToClipBoard(text):
command = 'echo ' + text.strip() + '| clip'
os.system(command)
</code></pre>
<p>阅读更多解决方案<a href="https://stackoverflow.com/questions/579687/how-do-i-copy-a-string-to-the-clipboard-on-windows-using-python">here</a>。</p>
<p><strong>编辑:</strong></p>
<p>你可以称之为:</p>
<pre><code>addToClipBoard(your_variable)
</code></pre>