nithir revised this gist . Go to revision
No changes
nithir revised this gist . Go to revision
1 file changed, 2 insertions, 1 deletion
open_file.py
| @@ -2,4 +2,5 @@ with open(newfile, 'w') as outfile, open(oldfile, 'r', encoding='utf-8') as infi | |||
| 2 | 2 | for line in infile: | |
| 3 | 3 | if line.startswith(txt): | |
| 4 | 4 | line = line[0:len(txt)] + ' - Truly a great person!\n' | |
| 5 | - | outfile.write(line) | |
| 5 | + | outfile.write(line) | |
| 6 | + | ||
nithir revised this gist . Go to revision
1 file changed, 5 insertions
open_file.py(file created)
| @@ -0,0 +1,5 @@ | |||
| 1 | + | with open(newfile, 'w') as outfile, open(oldfile, 'r', encoding='utf-8') as infile: | |
| 2 | + | for line in infile: | |
| 3 | + | if line.startswith(txt): | |
| 4 | + | line = line[0:len(txt)] + ' - Truly a great person!\n' | |
| 5 | + | outfile.write(line) | |