python search in website
<p>i try to create a filter to a large log file like</p>

<pre><code>Fri Oct  5 00:55:45 2012 [pid 2766] CONNECT: Client "157.82.250.217"
Fri Oct  5 00:55:45 2012 [pid 2765] [ftp] OK LOGIN: Client "157.82.250.217", anon password "mozilla@example.com"
Fri Oct  5 00:56:05 2012 [pid 2767] [ftp] FAIL DOWNLOAD: Client "157.82.250.217", "/pub/10.5524/100001_101000/100036/Gene_catalogue/Gene_catalogue.pep", 1638400 bytes, 81.81Kbyte/sec
Fri Oct  5 00:57:27 2012 [pid 3056] CONNECT: Client "157.82.250.217"
Fri Oct  5 00:57:27 2012 [pid 3055] [ftp] OK LOGIN: Client "157.82.250.217", anon password "-wget@"
</code></pre>

<p>I want to put the ip address in to  <a href="http://www.ip-adress.com" rel="nofollow">http://www.ip-adress.com</a> to get the organization name
like  157.82.250.217 --> University of Tokyo then add University of Tokyo behind ip address</p>

<p>The website is <a href="http://www.ip-adress.com/ip_tracer/157.XX.xxx.xx" rel="nofollow">http://www.ip-adress.com/ip_tracer/157.XX.xxx.xx</a>
and the source code like :</p>

<pre><code>    &lt;th&gt;ISP of this IP [&lt;a href="/isp" target="_self"&gt;?&lt;/a&gt;]:&lt;/th&gt;

    &lt;td&gt;

      University of Tokyo&lt;/td&gt;

    &lt;/tr&gt;

  &lt;tr class="odd"&gt;

  &lt;th&gt;Organization:&lt;/th&gt;

 &lt;td&gt;

  University of Tokyo&lt;/td&gt;

  &lt;/tr&gt;

  &lt;tr class="even"&gt;
</code></pre>

<p>I'm newcomer in python, i write some for filter time, and can you help me add function inside</p>

<pre><code>import time
f= open("/opt/CLiMB/Storage1/log/vsftp.log")
def OnlyRecent(line):
if  time.strptime(line.split("[")[0].strip(),"%a %b %d %H:%M:%S %Y")&gt;  time.gmtime(time.time()-(60*60*24*7)): 
    return True
return False
filename= time.strftime('%Y%m%d')+'.log'
f1= open(filename,'w')
for line in f:
if OnlyRecent(line):
        print line
        f1.write(line)
f.close()
f1.close()
</code></pre>

<p>Thanks!!</p>
