Reputation: 1179
I have a line like the following:
ping = subprocess.call('Fping.exe -H %s -L pingResults.txt -l' % 'IPsToPING')
Where IPsTPING
is a list, my problem is that it returns the IPs inside that list with [
(just the first IP and the last one with ]
) and single quotes around each IP like that:
'192.168.1.1'
The problem is that Fping.exe is failing to do its work since it gets an IP address with quotes.
I would like to somehow stripe these quotes from every IP (or list item), and the [
]
from the first and the last items.
I am using Python 3.x. Thanks.
Upvotes: 0
Views: 63
Reputation: 375654
You need to format the list of IPs yourself:
ip_string = ",".join(IPsToPING)
subprocess.call('Fping.exe -H %s ...' % ip_string)
(assuming a comma-separated list is what you want).
Upvotes: 2