Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

reset csv.DictReader python

# to read over a file multiple times you need to reset the pointer 
# of the file you open, not the reader object itself.
with open("file", "r") as file:
	file_reader = csv.DictReader(f)
	for i in anything:
  		#Do something
    	for item in file_reader:
        	if(something == something2):
                #Do something
        file.seek(0) # With this you can reset the pointer of the file and read
        			 # over it again
 
PREVIOUS NEXT
Tagged: #reset #python
ADD COMMENT
Topic
Name
7+9 =