I have a code that stops running each time there is an error. Is there a way to add a code to the script which will ignore all errors and keep running the script until completion?
Below is the code:
import sys
import tldextractdef main(argv):in_file = argv[1]f = open(in_file,'r')urlList = f.readlines()f.close()destList = []for i in urlList:print istr0 = ifor ch in ['\n','\r']:if ch in str0:str0 = str0.replace(ch,'')str1 = str(tldextract.extract(str0))str2 = i.replace('\n','') + str1.replace("ExtractResult",":")+'\n'destList.append(str2)f = open('destFile.txt','w')for i in destList:f.write(i)f.close()print "Completed successfully:"if __name__== "__main__":main(sys.argv)
Many thanks