I want to create list of result string based on if-else result, but currently only a 1-value string can be seen when running the loop.
Example:
for ips in npat:
ipnet = ips.strip()
print ("Processing ..... ", ipnet)
fgen = "grep " +ipnet+ " /mnt/hgfs/IRR/fgen.txt"
f2pat = re.findall(ipnet,fgen)
print ("\nCommand: ",fgen)
os.system(fgen)
print ("\n NEW NPATH: ",f2pat)
flist = []
if ipnet in f2pat:
flist.append("Grep Found")
print ("Result ", flist)
else:
flist.append("Grep NotFound")
print ("Result: ",flist)
flist -> ['Grep Found']...Only 1 value is in the list in spite of ther should be multiple values. May I know your ideas?
Thanks.
flist = []outside / above yourfor ips in npatloop?