Aug-16-2019, 02:40 PM
Then you get "or" on the end of the line. you can remove it after splitlines
x = "" for i in ips.splitlines(): x += "%s %s %s %s %s" % ("sourceIP =", "'{}'".format(i), "or destinationIP =", "'{}'".format(i), "or") k = x.rfind("or") x = x[:k] + "" + x[k+2:]