I got a file, I want to be able to get the content of this file and write them x number of time to another file based on a provided number.
I got this code but I get written the content of my file only one time.....
replace_num_array
is my number of time mentioned above.
def replace_lines(f, wf):
for i, line in enumerate(f, 1):
wf.write(line)
def copy_cust(f, wf, replace_num_array):
for y in replace_num_array:
replace_lines(f, wf)
def process_file(filename, writefile, tagname, rectype_whereTagNameGoes, tagname_whichrec_coordinates_findall, replace_coordinates_findall, replace_num_array):
with codecs.open(filename, 'r', encoding='utf-8', errors='ignore') as f:
with open(writefile, 'a+') as wf:
copy_cust(f, wf, replace_num_array)
Any help is much appreciated, I am pretty new to Python, probably I am doing something quite silly here...
I don't get error with my code but I don't get copy X number of time, I think I am writing over the same contents :-)
Thanks,
Paolo