Using lists, you can convert the original "mylist" list to a list with a URL prefix as follows:
urllist = ['/myurl/%s' % the_file for the_file in mylist]
Analysis:
a) the expression in square brackets is an understanding of the list. he says: iterate over each element in "mylist", temporarily calling the iterated element "the_file" and transforming it using a subexpression: '/ myurl /% s'% the_file
b) the conversion expression says, create a line where% s is replaced by the line represented by the value "the_file"
source share