import pyperclip
text=pyperclip.paste()
lines=text.split('\n')
for i in range(len(lines)): #loop through all indexes in the 'lines' list
lines[i]='* '+lines[i] #add star to each string in 'lines' list
text='\n'.join(lines)
print(pyperclip.copy(text)) #>>>这个位置打印结果为None
不清楚哪里有问题
pyperclip模块中有两个函数,分别是copy()和paste(),copy()用于向计算机的剪贴板发送文本,paste()用于从计算机剪贴板接收文本
完整代码
import pperclip
text = pyperclip.paste()
lines = text.split('\n')
for i in range(len(lines)):
lines[i] = ' * ' + lines[i]
text = '\n'.join(lines)
print(pyperclip.paste())
##paste()不能添加参数。