Usefull Python Scripts

Remove lines from File containing: bad_words import sysbad_words = [‘one bad word’,’ another bad word’]scriptname = sys.argv[0]for _old in sys.argv: if _old == scriptname: continue _new = _old + ‘_filter_x.log’ print(“processing ‘” + _old + “‘\n\noutput: ” + _new + “\n\n\n\n”) with open(_old) as oldfile, open(_new, ‘w’) as newfile: for line in oldfile: if any(bad_word Read More …