Sep-06-2019, 11:35 PM
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:
- Copy IPs from a column in excel
- Add a comma between each IP separated by a space
- Return as one line
- Copy back to clipboard using pyperclip.
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 providing understanding on what I'm missing and getting the desired results would be appreciated.