Created
October 8, 2019 16:21
-
-
Save bschne/cffdedb0df027b661f16fd506eb5000b to your computer and use it in GitHub Desktop.
HS2019-Inf1-Lec4 Exercise 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| def copy_file(src, dest, header): | |
| with open(dest, "w+") as d: | |
| d.write(header + "\r\n") | |
| with open(src) as s: | |
| for line in s: | |
| d.write(line) | |
| header = "--- Copied by my python script ---" | |
| copy_file("test.txt", "new-file.txt", header) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment