Over a million developers have joined DZone.

Getting HTML From Windows Clipboard

·
Get the code for class HtmlClipboard() by Phillip Piper here.

Usage

>>> cb = HtmlClipboard()
>>> cb.GetAvailableFormats()
[49161, 49562, 49339, 49560, 49561, 13, 1, 49334, 49335, 49333, 49344, 49478, 49171, 16, 7]
>>> cb.HasHtmlFormat()
True
>>> cb.GetFromClipboard()
>>> cb.htmlClipboardVersion
'0.9'
>>> cb.GetFragment()
'

Writing to the clipboard is easy with this code.

' >>> cb.GetSource() 'http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/474121' >>>
You can also put a html fragment to the clipboard as well. See more detials in the recipe.
Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}