I have a program that i have wrote, internally i am using the Fping program in order to send pings to other computers, the Fping program needs to get a file that includes a list of IP address in order to get Fping to send pings automatically to a bunch of IP address.
Right now in my script i am creating a file on the disk then call Fping to use that file, then i am deleting the file.
I would like to know if there is a way to create a file-like object that is acting as a file, then i could call Fping to use that object instead of a real file.
I am using Python 3, and Fping for Windows.
Thanks.
Because
fpingcan read in the list of machines from standard input (see details in the man page) you simply need to write the addresses to standard input. Thesubprocessmodule can provide some ways to write data to standard input, but if all the data is known at the start, a (somewhat tacky) way to do this is to addechoto your command.