I am new to Python programming. While making an application, I ran into this problem. 
I am parsing URL using urllib library of python. I want to convert any relative url into its corresponding absolute url. I get relative and absolute URLs in random fashiion and they may not be from the same domain. Now how do I store the last known absolute url to extract the netloc from it and append it to relative url? Should I save the last known absolute URL in a text file? Or is there any better option to this problem?
Now how do I store the last known absolute url to extract the netloc
  from it and append it to relative url? Should I save the last known
  absolute URL in a text file?

What do you think is wrong with this? Seems to make sense to me... (depending on context, obviously)
URL parsing issue in python