Python ping script from file.
I'm trying to create a small python ping script which reads ip addresses' from a .txt file and pings them each twice. I can do it no problems with subprocess and just 1 ip address(no .txt file)
But Im just struggling with how to pass the ip addresses to the ping function. Im guessing im meant to readlines() but im stuck on how i get python to use the ip address and actually perform the ping for each ip address.
...confused as hell. Hopefully someone gets what i mean and can help.
thanks in advance.
Yes you probaly can use readlines. readlines returns a list of each line in the file. You can also use the with statement when you open the file, so assuming your file is something like:
I hope that helps and don't forget you can always use dir(obj) and help(obj) from the python console to get help on how to use a module or object
|All times are GMT -5. The time now is 01:05 AM.|