Save outputs to Desktop - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Save outputs to Desktop (/thread-12567.html) |
Save outputs to Desktop - cisicomania - Aug-31-2018 Hello, I wrote my first script. It is logging to 2 Router's console\CLI and executing few commands. Afterwards in Router's console I have outputs which shows me for example IP Addresing My question is how to save those outputs to my Desktop in text document format.import getpass import sys import telnetlib print ("Script starts") HOST = "71.61.14.36" tn = telnetlib.Telnet(HOST, "33153",) print ("Telnetting to device") tn2 = telnetlib.Telnet(HOST, "33154",) print ("Telnetting to device") print ("Executing commands") tn.write("\n\n\n\n") tn.write("\n\n\n\n") tn.write("enable\n") tn.write("show ip interface brief\n") tn.write("show interfaces description\n") print ("Executing commands") tn2.write("\n\n\n\n") tn2.write("\n\n\n\n") tn2.write("enable\n") tn2.write("show ip interface brief\n") tn2.write("show interfaces description\n") tn2.close() RE: Save outputs to Desktop - Gribouillis - Aug-31-2018 I don't have the answer, but there is an impressive wrapper of telnetlib with logging capabilities in the robotframework source code, you could perhaps find ideas here. |