Now, for the loop. It is essentially the same loop that I analyse in my tutorial on reading a file all-at-once. The code looks like this:
while line:
data = string.split(line, ';')
feedname = data[0]
address = data[1]
record[feedname] = address
line = datafile.readline()
In using the string library function split, we pass the string to be split followed by its delimiter. The result is a list of values being passed to the variable, here data. From then we can assign values to different variables, thus allowing us to use the feed's name as the key and the feed's address as the value.
At the end of it, one has a dictionary called record that holds each line of the file. The site name of the feed is the key, and the value of each key is the address of that site's RSS file. If you are at all unclear about dictionary keys and values, you should read my treatment of Python data types.
The value of the dictionary record is then returned as the output of the function.
But, you might say, won't the feedname variable interfere or replace the feedname variable that we defined in the beginning? No. In Python, variables have an aspect called scope that allows variables defined within functions to exist within those functions and cease to exist when the function ends. As long as we do not call or rely upon the first value feedname, Python pays no mind. When the function finishes, the function variable feedname ceases to exist in the mind of the computer.

