Downloading multiple files based on info extracted from CSV

Matt Graves tunacubes at
Thu Dec 12 22:43:50 CET 2013

I have a CSV file containing a bunch of URLs I have to download a file from for clients (Column 7) and the clients names (Column 0) I tried making a script to go down the .csv file and just download each file from column 7, and save the file as [clientname].csv

I am relatively new to python, so this may be way off but…

import urllib 
import csv
urls = []
clientname = []

###This will set column 7 to be a list of urls
with open('clients.csv', 'r') as f:
    reader = csv.reader(f)
    for column in reader:

###And this will set column 0 as a list of client names
with open('clients.csv', 'r') as g:
    reader = csv.reader(g)
    for column in reader:

###This SHOULD plug in the URL for F, and the client name for G.
def downloadFile(urls, clientname):
    urllib.urlretrieve(f, "%g.csv") % clientname


When I run it, I get : AttributeError: 'file' object has no attribute 'strip'

More information about the Python-list mailing list