擅长:python、mysql、java
<p>如果您只想将剪贴板中的内容粘贴到字符串中,您可以使用其中一个包<a href="https://github.com/asweigart/pyperclip" rel="nofollow">^{<cd1>}</a>或{a2},这两个包都是pip安装的。在</p>
<pre><code>import pyperclip
print(pyperclip.paste())
#or equivalently...
import clipboard
print(clipboard.paste())
</code></pre>
<p>如果我复制此页面的url,将给出输出<code>'http://stackoverflow.com/questions/35475103/how-can-i-get-a-url-from-chrome-by-python'</code>(两次…)。在</p>