Adding Bullets to Wiki Markup doesnt copy asterix

426 Views Asked by At

Im running the Project "Adding Bullets to wiki Markup" and encounter the issue, that the * are not copied after I run my code.

#! python3
# Adds Wikipedia bullet points to the start
# of each line of text on the clipboard.

import pyperclip
text = pyperclip.paste()

#Separate lines and add stars.
lines = text.split('\n')
print(lines)
print(len(lines))
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)
pyperclip.copy(text)
print(text)

I added a few lines to see what the code is doing, while its being executed and its doing it's job, but after the program has run, pyperclip.copy(text) seems to "reset" itself to what it was before So if I copy: Banana Apples Oranges

the code does change it to *Banana *Apples *Oranges

but after its finished and I paste it into a txt. file or display it through the terminal with pyperclip.paste(), it returns the original list without the asterix.

Any ideas? Thanks in advance

0

There are 0 best solutions below