I have a python script, with a nested for loop
HostList = file('trylist.txt')
DestHostList = file('trylist2.txt')
for DestHost in DestHostList:
DestHost = DestHost.strip()
for HostName in HostList:
HostName = HostName.strip()
try:
if DestHost!=HostName:
print HostName,DestHost
print "one loop finishes"
except Exception, e:
ExceptionHost.write(HostName+' - '+DestHost+': '+str(e)+'\n')
print "exception"
#traceback.print_exc(file=sys.stdout)
The outer for loop appears to be only executed once.
What could be the potential problem?
DestHostListhas only one element?HostList.