[Tutor] Python function

Alan Gauld alan.gauld at yahoo.co.uk
Thu Dec 13 19:47:03 EST 2018


On 13/12/2018 17:21, Sammy Lee wrote:
> How do I create a python function that opens a CSV file and determines how many columns
> of data are in the file? The CSV files have been randomly generated from https://www.mockaroo.com/
> 
> def csv_column_count(openfile):

You will find a bunch of stuff on creating functions in the Functions
and Modules topic of my tutorial.(see below)

You will find a bunch of stuff on handling files in the Handling Files
topic of my tutorial.(see below)

You will find a lot of help on using CSV files in the csv module
documentation in the standard library. (Or you could buy my book
"Python Projects" which has a section on the topic.)



-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list