May-05-2019, 02:52 PM
I am trying to print the payload variable onto multiple lines. It currently prints on one line.
I am using the indent statement but it still prints on one line.
Can you help?
Step 1:
Results:
I am using the indent statement but it still prints on one line.
Can you help?
Step 1:
payload = json.dumps({"ip-detunnel": "No", "name": "DP800 Slot 1", "vlan-tag-insertion": "No", "vlan-tag-remove-forward": "Remove", "mac-replace-header": "No", "mpls-label-stack": "Pass Through" })Step 2:
print '\n' + (json.dumps(payload, indent=4))Step 3:
Results:
Output:"{\"vlan-tag-insertion\": \"No\", \"name\": \"DP800 Slot 1\", \"mpls-label-stack\": \"Pass Through\", \"vlan-tag-remove-forward\": \"Remove\", \"ip-detunnel\": \"No\", \"mac-replace-header\": \"No\"}"