Looping a Python split function
<p>I'm trying to strip subdomains off of a large list of domains in a text file. The script works but only for the last domain in the list. I know the problem is in the loop but can't pinpoint the extact issue. Thanks for any assistance:)</p>

<pre><code>with open ("domainlist.txt", "r") as datafile:
s = datafile.read()
for x in s:
    t = '.'.join(s.split('.')[-2:])

print t
</code></pre>

<p>this will take "example.test.com" and "return test.com". The only problem is it won't perform this for every domain in the list - only the last one.</p>
