Saved Bookmarks
| 1. |
Prepare a program in python that copies a text file "source.text" onto "target.text" barring the lines starting with character 'U'. |
|
Answer» from os import path if path.isfile("source.txt") and path.isfile("target.txt"): with open("source.txt", 'r') as source: with open("target.txt", 'w') as target: for sentence in source.readlines(): if not sentence.startswith('U'): target.write(sentence) print("TASK executed successfully!") |
|