用pyperclip替换win32con
This commit is contained in:
parent
4f673d3b8d
commit
686f57e216
|
|
@ -1,6 +1,6 @@
|
||||||
import json,re,os,Levenshtein,fitz,time,sys,win32con
|
import json,re,os,Levenshtein,fitz,time,sys
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import win32clipboard as wc
|
import pyperclip
|
||||||
|
|
||||||
def GetDate(): #获得当前日期
|
def GetDate(): #获得当前日期
|
||||||
currentdate = str(time.localtime().tm_year)+str(time.localtime().tm_mon).zfill(2)+str(time.localtime().tm_mday).zfill(2)
|
currentdate = str(time.localtime().tm_year)+str(time.localtime().tm_mon).zfill(2)+str(time.localtime().tm_mday).zfill(2)
|
||||||
|
|
@ -1343,18 +1343,17 @@ def getlineindex(string,filepath): #返回字符串在文本文件中第一次
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def getCopy(): # 获取剪切板内容
|
def getCopy(): # 获取剪切板内容
|
||||||
wc.OpenClipboard()
|
t = pyperclip.paste().replace("\r","")
|
||||||
t = wc.GetClipboardData(win32con.CF_UNICODETEXT)
|
|
||||||
t = t.replace("\r\n","\n")
|
|
||||||
wc.CloseClipboard()
|
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
|
||||||
def setCopy(string): # 写入剪切板内容
|
def setCopy(string): # 写入剪切板内容
|
||||||
wc.OpenClipboard()
|
pyperclip.copy(string)
|
||||||
wc.EmptyClipboard()
|
|
||||||
wc.SetClipboardData(win32con.CF_UNICODETEXT, string)
|
# wc.OpenClipboard()
|
||||||
wc.CloseClipboard()
|
# wc.EmptyClipboard()
|
||||||
|
# wc.SetClipboardData(win32con.CF_UNICODETEXT, string)
|
||||||
|
# wc.CloseClipboard()
|
||||||
|
|
||||||
def itemizeProblems(string): #将题号替换为\item
|
def itemizeProblems(string): #将题号替换为\item
|
||||||
string_list = string.split("\n")
|
string_list = string.split("\n")
|
||||||
|
|
|
||||||
Reference in New Issue