Writing telnet output to file


















I have made some code that will login to a device and send all your additional commands. It also logs the commands and the returned values to a file on the local system. Hope somebody can tell me if the code is a little effective or how I can optimize it. I also have a question about the Sleep I think it's not so effective because some commands take longer then others. How can I resolve this can you let it sleep until a certain reply is given?

As I run the code with a other program which not give feedback other then failed. That is why the errors are redirected to a file. Argparse is the standard way of dealing with command line arguments and it automatically generates information messages for the user, so it has extra convenience. If you are not yet ready to refactor like this, then you can use at least tuple unpacking and slicing :. Please note that line should be renamed lines because it is a list of lines not a single line.

As you can see the core of the logic discarding blank lines is still there but without the waste of space and effort that there was before. The comments are too specific, as we always say on this site comment on the why, not on the how , comments like Create empty variable for usage in for x in line loop.

Sign up to join this community. The best answers are voted up and rise to the top. Installing telnet. Skip to main content.

This browser is no longer supported. Download Microsoft Edge More info. Contents Exit focus mode. Use script for telnet with regular expression functionality to recover information on functionality. Try run the. Office Office Exchange Server. Not an IT pro? Windows Server TechCenter. Sign in. United States English. Active Oldest Votes. Improve this answer. Wuffers Wuffers Everything else works. Ignacio Vazquez-Abrams Ignacio Vazquez-Abrams k 8 8 gold badges silver badges bronze badges.

Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.



0コメント

  • 1000 / 1000