Python 3 Count number of rows in a CSV

Keywords: python python-3.x csv migration

Question: 

Im having trouble getting the row count in a python 3 environment after migrating from 2.7. After several attempts the number of rows returned gives one. How do I get around a DeprecationWarning: 'U' mode is deprecated in python 3 ?

             input_file = open("test.csv","rU")
             reader_file = csv.reader(input_file)
             value = len(list(reader_file))

In the case of using python 3 Ive tried the following approach but Im still stuck with a 1.

             input_file = open("test.csv","rb")
             reader_file = csv.reader(input_file)
             value = len(list(reader_file))

Answers: 

input_file = open("test.csv","rb") #rb is a read-in-binary format and you can't count the number of rows from binary format file