Question: I'm new to Python and I'm wanting to print only the first 10 lines of a huge csv file. 

Here's my code so far that prints all of the lines in the csv file

```
import csv
with open('titanic.csv') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        print(row['survived'], row['pclass'], row['name'], row['sex'], row['age'])

```

Answer: 
You could just `break` after 10 lines.

```
import csv
with open('titanic.csv') as csvfile:
    reader = csv.DictReader(csvfile)
    for i,row in enumerate(reader):
        print(row['survived'], row['pclass'], row['name'], row['sex'], row['age'])
        if(i >= 9):
            break

```
May be this could help you

**Code :**

```
count = 0
rg = 10
with open('/content/gdrive/MyDrive/Colab Notebooks/employee.csv','r') as csvdt:
  csv_rd = csv.reader(csvdt)
  for j in  csv_rd:
    if count < rg:
      print(j)
      count = count + 1  

```