Reputation: 11
I am using this line of code:
fwhost1 = "172.16.17.1"
print("Connecting via API call, backing up the configuration for:", fwhost1)
The output from this line is:
('Connecting via API call, backing up the configuration for:', '172.16.17.1')
I am looking to not have the parenthesis and the single quotes appear on the output while the script is running.
Thank you
I have tried adjusting the line of code but this is the only way it will run without an error
Upvotes: 1
Views: 71
Reputation: 46620
You can use the +
operator to concatenate strings. More info here
fwhost1 = "172.16.17.1"
print("Connecting via API call, backing up the configuration for: " + fwhost1)
Here's another way of printing using %-formatting
print("Connecting via API call, backing up the configuration for: %s" % fwhost1)
Another option is using str.format()
print("Connecting via API call, backing up the configuration for: {}".format(fwhost1))
If you're using Python 3, you can use f-strings
print(f"Connecting via API call, backing up the configuration for: {fwhost1}")
Output
Connecting via API call, backing up the configuration for: 172.16.17.1
Upvotes: 3
Reputation: 5933
A more pythonic way is to use format
function over strings
fwhost1 = "172.16.17.1"
print ("Connecting via API call, backing up the configuration for:{}".format(fwhost1))
Upvotes: 2