Having trouble writing data to a file
<p>i am currently using this code the top part is right but i cant seem to save it to file</p>

<p>this my current code</p>

<pre><code>for line in myfile:
list_of_line = line.split()
if 'Failed password for' in line:
    ip_address_port = list_of_line[-4]
    ip_address_list = ip_address_port.split(':')
    ip_address = ip_address_list[0]
    print '\'',ip_address,'\''
    if ips_desc.has_key(ip_address):
        count_ip = ips_desc[ip_address]
        count_ip + count_ip +1
        ips_desc[ip_address] +=1
        count_ip =0
    else:
        ips_desc[ip_address] = 1

print ips_desc

myfile = open('blacklist.txt','w')
for ips_items in ips_desc.keys():
myfile.write(ips_items)
</code></pre>

<p>but last 3 lines dont work any ideas?</p>
