It looks like you're new here. If you want to get involved, click one of these buttons!
I have this python function where I open two files, one for reading and one for writing. I iterate through
input_file and I write some items from it to the
with open(input_file, 'r') as source, open(save_file, 'w') as dest: reader = csv.reader(source) writer = csv.writer(dest) for row in reader: #do_something find_min(save_file, threshold)
Although through the iteration I want to call another function and iterate through the items that I have appended on the
save_file, but when i call it and try to print them nothing is printed.
This is the function that I call:
def find_min(file, threshold): with open(file, 'r') as f: reader = csv.reader(f) for i in reader: print(i)
If I try to call
find_min function outside of
with statement, the file is iterated normally and it's printed.
But I want to call this function a lot of times in order to analyze and compress the initial data.
So, does anyone know how to to iterate through the