print (output) - 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: print (output) (/thread-34815.html) |
print (output) - taaperaban - Sep-03-2021 so the below will print out the result of the show command. How do I get it to print out the show command prior to the result of the show command? like i want it to print out "show ip int brief" prior to show ip int brief results output = net_connect.send_command("show ip int brief") print (output) RE: print (output) - buran - Sep-03-2021 something like this? output = net_connect.send_command("show ip int brief") print(f'show ip int brief: {output}') RE: print (output) - naughtyCat - Sep-03-2021 There are three ways: command = "Hello World!" print(f"my command is {command}") print("my command is %s"%command) print("my command is {}".format(command))
RE: print (output) - deanhystad - Sep-03-2021 I use this one a lot for debugging programs too small to warrant logging. print(f'{2**3 = }') Not quite what you want since it prints the command, not the sent command.print(f'{net_connect.send_command("show ip int brief") = }')
|