Using a String Function with CSV Strings

I am trying to print all the data from csv to lowercase, but I had no luck.

Here is what I still have:

import csv books = csv.reader(open("books.csv","rb")) for row in books: print row 

This prints all the contents of csv, but when I add the .lower() function, I get errors.

What am I doing wrong?

+4
source share
1 answer

Try

 print [r.lower() for r in row] 
+7
source

Source: https://habr.com/ru/post/1383008/


All Articles