Hello! I have a problem with writing the results of the script to a file. In this code snippet:
print 'ip: ', sw.ip_sw.ljust(15), '\tlocation: ', name_adr.split(' ')[-2].rjust(20), '\tports UP: ', str(sw.ports_up).rjust(2), '\tports DOWN: ', str(sw.ports_down).rjust(2), '\tports ALL: ', str(sw.ports_up+sw.ports_down).rjust(3)
I display the results of the values on the screen. The same is necessary to write to a file. A design of this type:
fil = open('./portlog', 'w') fil.write(sw.ip_sw, name_adr, sw.ports_up, sw.ports_down, sw.ports_up+sw.ports_down) fil.close()
Does not work. Tell me what I'm doing wrong.