On Jan 7, 1:21 am, Francesco Pietra <[EMAIL PROTECTED]> wrote: > Please, how to adapt the following script (to delete blank lines) to delete > lines containing a specific word, or words? > > f=open("output.pdb", "r") > for line in f: > line=line.rstrip() > if line: > print line > f.close() > > If python in Linux accepts lines beginning with # as comment lines, please > also > a script to comment lines containing a specific word, or words, and back, to > remove #. > > Thanks > francesco pietra > > > ____________________________________________________________________________________ > Looking for last minute shopping deals? > Find them fast with Yahoo! Search. > http://tools.search.yahoo.com/newsearch/category.php?category=shopping
for line in open("file"): if not "word" in line: print line on the command, use the ">" operator to redirect to a file -- http://mail.python.org/mailman/listinfo/python-list