I'm currently working on a project and got stuck here. I've got a csv file that has 8 rows of data
- row 1
- row 2
- row 3
- row 4
- row 5
- row 6
- row 7
- row 8
I'm trying to make it to read the first 4 rows, write them to a new csv file, then do the same with with the next 4 rows of data. So I thought if I code it to find the total rows of data in the original csv, then divide it by 4, and make my code to read the first pack of data, then read the second pack of data, Currently it's just reading the whole 8 rows of data again again and again, now I'm just not even sure if i'm coding it towards the correct direction
import csv
with open('a.csv','r') as e:
csv_raw=csv.reader(e)
csv_raw_cont = list(csv_raw)
value = len(csv_raw_cont)
print(value)
forum_post_numbers = int(value/4)
print(forum_post_numbers)
e.seek(0)
for j in range(0,forum_post_numbers):
for i in range(0,value):
print(csv_raw_cont[i])