 <pre><code>def buildNR(nr): return 'http://file.server.com/content.asp?H=cat1&amp;NR={}&amp;T=abc'.format(nr) for line in csv.read(): nr = extract_nr(line) download_file(buildNR(nr)) </code></pre> <p>Just read the csv file and extrace the <code>NR</code> field.</p>