#!/usr/bin/env python # -*- coding:utf-8 -*- __author__ = "loki" import win32con import win32clipboard as wincld def get_text(): wincld.OpenClipboard() text_result = wincld.GetClipboardData(win32con.CF_UNICODETEXT) wincld.CloseClipboard() return text_result def set_text(info): wincld.OpenClipboard() wincld.EmptyClipboard() wincld.SetClipboardData(win32con.CF_UNICODETEXT, info) wincld.CloseClipboard() # set clipboard set_text('loki_demo') # read clipboard print(get_text())