title: How to obtain the total numbers of rows from a CSV file in Python?
body: <p>I'm using python (Django Framework) to read a CSV file. I pull just 2 lines out of this CSV as you can see. What I have been trying to do is store in a variable the total number of rows the CSV also.</p>
  
  <p><strong>How can I get the total number of rows?</strong></p>
  
  <pre><code>file = object.myfilePath
  fileObject = csv.reader(file)
  for i in range(2):
      data.append(fileObject.next()) 
  </code></pre>
  
  <p>I have tried:</p>
  
  <pre><code>len(fileObject)
  fileObject.length
  </code></pre>