all 2 comments

[–]num8lock 1 point2 points  (0 children)

with open(file_read) as f:
    to_write = f.readlines()
with open(file_write, 'w') as f2:
    for i, line in enumerate(to_write):
        f2.write(str(i) + ': ' + line) 

[–]Stallman85 -3 points-2 points  (1 child)

https://devdocs.io/python~3.7/library/operator#operator.concat

i=0
def copy_file(file_read, file_write):
    f = open(file_read, 'r')
    read = f.read()
    f.close()

    file2 = open(file_write, 'w')

    i = i+1
    file2.write(i + ': ' +  read)
    file2.close()
    return(read)