appending to beginning of line
Bob
bobx at linuxmail.org
Tue Oct 8 08:22:23 EDT 2002
More information about the Python-list mailing list
Tue Oct 8 08:22:23 EDT 2002
- Previous message (by thread): appending to beginning of line
- Next message (by thread): appending to beginning of line
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I have this script:
# loop through the list and print the lines to a file
for line in inFile.xreadlines():
for badword in kw:
if line.find(badword) > -1:
found = '%s %s' % (badword, line)
print found # Print the result
outFile.write(found) # Write the result
This will print the badword and then the line it is on. For those
lines that do not contain a badword I want to place a hyphen "-".
Bob
- Previous message (by thread): appending to beginning of line
- Next message (by thread): appending to beginning of line
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list