resolv=open("/etc/resolv.conf","r") for line in resolv.readlines(): #The first test checks if the line has already been "skipped". The second test #checks for servers which do not have a private address. Finally, the else #condition will commment out any uncommented private servers. if sre.search('Skip', line): tmp=tmp+line elif not sre.search('192.168.1*', line): tmp=tmp+line else: tmp=tmp+"#Skipped! Bad router! #"+line resolv.close()
…and my Preserve Code Formatting plug-in still works. Yay! for me. :) This little treadmill exercise is almost over.