Python extract data from file and output to another
<p>I have a text file with a list of urls. Given a url like each is a line by itself: "<a href="https://rads.stackoverflow.com/amzn/click/com/B00KDVJLJW" rel="nofollow noreferrer" rel="nofollow noreferrer">https://www.amazon.com/George-Foreman-GRP1060B-Serving-Removable/dp/B00KDVJLJW</a>"
"<a href="https://rads.stackoverflow.com/amzn/click/com/B014DAVCP4" rel="nofollow noreferrer" rel="nofollow noreferrer">https://www.amazon.com/ThermoPro-Wireless-Digital-Kitchen-Thermometer/dp/B014DAVCP4</a>"</p>

<p>Here is the code:</p>

<pre><code>linedata = []

with open("url.list") as f:
    for line in f:
        linedata = line.split('/')

        Title = '/'.join(linedata[3:4])
        Asin = ''.join(linedata[5]) + ''

f = open("url.text","a")

    for list in linedata:
    f.write(str(Asin))
    f.write('\n')

f.close
</code></pre>

<p>The code works partially. The loop doesn't work why ? and how do I write Title and asin to file on the same line? I am running python 2.7 and thanks in advance.</p>