import pyperclip with open('pyper.txt','r') as py1: pyperclip.copy(str(py1.read())) #pyperclip.copy("Lists of animals\nLists of aquarium life\nLists of biologists by author abbreviation\nLists of cultivars\nLists of each line\nLists of text on the clipboard.") text = pyperclip.paste() # Separate lines and add stars. lines = text.split('\n') for i in range(len(lines)): # loop through all indexes for "lines" list lines[i] = '* ' + lines[i] # add star to each string in "lines" list text = '\n'.join(lines) print(text) #pyperclip.copy(text) with open('pyper.txt','a') as py2: py2.write(text)