我怎样才能从一个HTML文件复制到Python格式化文本中的剪贴板? [英] How can I copy from an html file to the clipboard in Python in formatted text?

查看:381
本文介绍了我怎样才能从一个HTML文件复制到Python格式化文本中的剪贴板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个Word文档,我想直接从剪贴板粘贴一个格式化的代码片段。



在这一刻,我可以写这些将.html文件切片到硬盘。我的目标是扩展我的Python脚本,并在剪贴板上以格式化文本加载此.html文件,以直接粘贴到Word。



有谁知道任何方法可以做这在Python?



预先感谢。



Sherab

解决方案

好的,我找到了一个解决方案。


$ b

http://code.activestate.com/recipes/474121-getting-html-from-the- windows-clipboard /



工作得很好......如果有人想了解关于剪贴板的更多信息,请看看这里:



http://msdn.microsoft.com/en-us/library/windows/desktop/ms649013(v = vs.85).aspx

下载pywin32模块和win32clipboard你可以做任何事情。


I'm writting a Word document and I'd like to paste a formatted code-snippets directly from clipboard.

At this moment I am able to write these snippets into an .html file to the harddisk. My goal is to extend my Python script and load this .html file on the clipboard in "formatted text" to directly paste at Word.

Does anyone knows any way to do this in Python?

Thanks in advance.

Sherab

解决方案

Well, I've found a solution for this.

http://code.activestate.com/recipes/474121-getting-html-from-the-windows-clipboard/

It's work pretty well... if anyone wants more information about the clipboard just take a look here:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms649013(v=vs.85).aspx

Download the pywin32 module and with win32clipboard you can do everything.

这篇关于我怎样才能从一个HTML文件复制到Python格式化文本中的剪贴板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆