用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 win32clipboard as wc
|
||||
import pyperclip
|
||||
|
||||
def GetDate(): #获得当前日期
|
||||
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
|
||||
|
||||
def getCopy(): # 获取剪切板内容
|
||||
wc.OpenClipboard()
|
||||
t = wc.GetClipboardData(win32con.CF_UNICODETEXT)
|
||||
t = t.replace("\r\n","\n")
|
||||
wc.CloseClipboard()
|
||||
t = pyperclip.paste().replace("\r","")
|
||||
return t
|
||||
|
||||
|
||||
def setCopy(string): # 写入剪切板内容
|
||||
wc.OpenClipboard()
|
||||
wc.EmptyClipboard()
|
||||
wc.SetClipboardData(win32con.CF_UNICODETEXT, string)
|
||||
wc.CloseClipboard()
|
||||
pyperclip.copy(string)
|
||||
|
||||
# wc.OpenClipboard()
|
||||
# wc.EmptyClipboard()
|
||||
# wc.SetClipboardData(win32con.CF_UNICODETEXT, string)
|
||||
# wc.CloseClipboard()
|
||||
|
||||
def itemizeProblems(string): #将题号替换为\item
|
||||
string_list = string.split("\n")
|
||||
|
|
|
|||
Reference in New Issue