So i have a big csv file and my code prints all the rows but i want to print, for example, only 20 random rows from 100000 rows. I know that somehow with random.sample
u can do that, but i don't really know how. Any suggestions?
There is my code:
import csv
with open(r'Z:/**/**/**/test_examples_doors/
**') as csvfile:
data = csv.DictReader(csvfile)
for row in data:
if row['open']=='1':
print(row['image'], row['open'])