Skip to content

Instantly share code, notes, and snippets.

@bschne
Created October 8, 2019 16:21
Show Gist options
  • Select an option

  • Save bschne/cffdedb0df027b661f16fd506eb5000b to your computer and use it in GitHub Desktop.

Select an option

Save bschne/cffdedb0df027b661f16fd506eb5000b to your computer and use it in GitHub Desktop.
HS2019-Inf1-Lec4 Exercise 3
#!/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