Check for Dead Links on soundcloud using text file with Python
<p>Python 2.7</p>

<h2>Windows 10 x64</h2>

<p>I have a .txt file full of soundcloud links and was wondering how I can use this txt file as input and loop through the links checking for the error       that the header displays. And then printing those that do not give the error.</p>

<p>This what I have but it keeps giving me 404.</p>

<pre><code># Test Dead Link
# https://soundcloud.com/nightsanity-793590747/the-xx-intro
# Working Link
# https://soundcloud.com/madeleinepeyroux/everything-i-do-gonna-be-funky

import requests
filename = 'data.txt'
with open(filename) as f:
    data = f.readlines()

for row in data:
    r = requests.get(row)
    r.status_code
    if r.status_code == 404:
        print 'The Link is Dead'
    else:
        print 'The Link is Alive' 
</code></pre>