I'm using python 3.7 and I want to:
Below is the desired pasted results:
10.10.10.10, 10.10.10.11, 10.10.10.12, 10.10.10.13, 10.10.10.14
I have looked at some answers I found here and here but it's not printing the desired results. Below, I have tried the following codes but none seem to do it for me:
#code 1
import pyperclip
text = pyperclip.paste()
lines = text.split('\n')
pyperclip.copy('\n'.join(lines))
#code2
import pyperclip
text = pyperclip.paste()
lines = text.split('\n')
a = '{}'.format(', '.join(lines[:-1]))
pyperclip.copy(''.join(a))
#code3
import pyperclip
text = pyperclip.paste()
lines = text.split('\n')
a = '{}'.format(', '.join(lines[:-1]))
pyperclip.copy(a)
Assistance on fixing this and understanding would be greatly appreciated.
Try this way:
import pyperclip
text = pyperclip.paste()
lines = text.split()
pyperclip.copy(', '.join(lines))