simplify appending domain to filenames in python

Go To StackoverFlow.com

0

I'm just learning about python. I'm fairly new.

I have the following code that takes in a csv file and replaces the filenames and appends the domain to it:

import csv
...
    cr.reader(open('foo.csv', 'rb'))
    ...
    for i in rows enumerate(csvreader):
      images = 'http://www.foo.com/%s' % row[-3], 'http://www.foo.com/%s' % row[-4]
      row[-3], row[-4] = images[0], images[1]

There a more elegant way to simplify appending the url to the filenames?

2012-04-03 21:33
by chrisjlee


1

row[-3], row[-4] = 'http://www.foo.com/' + row[-3], 'http://www.foo.com/' + row[-4]
2012-04-03 21:37
by Mark Ransom