Oct-29-2022, 08:13 PM
your strings must be enclosed in single or double quotes.
here's a display routine that accesses all nodes of structure:
here's a display routine that accesses all nodes of structure:
ipstructure = {'name': 'xxxx', 'ipv4_start': 'xxxx', 'ipv4_cidr': 'xx', 'ipv4_address_domain_id': 'xxxx', 'INFO-ipv4_address_domain_name': 'xxxx', 'ipv4_address_domain_range_id': 'xxxx', 'INFO-ipv4_address_domain_range_name': 'xxxxx', 'ipv4_allocation_template_id': 'xxxx', 'dhcp_relay_id': '', 'ipv6_start': 'xxxx::', 'ipv6_cidr': 64.0, 'ipv6_address_domain_id': 'xxxx', 'INFO-ipv6_address_domain_id': 'xxxxx', 'ipv6_address_domain_range_id': 'xxxxx', 'INFO-ipv6_address_domain_range_name': 'xxxxxx::/49', 'ipv6_allocation_template_id': 'xxxx', 'dhcpv6_relay_id': '', 'l2_vni_value': '', 'INFO-l2_vni_name': '', 'l2_domain_id': '', 'INFO-l2_domain_name': '', 'dns_domain_id': '', 'INFO-dns_domain_name': '', 'is_infoblox_synced': 'xxxx', 'is_private': 'xxxx', 'tenant_id': 'xxxx', 'INFO-tenant_name': 'xxxx', 'partition_id': 'xxxx', 'INFO-partition_name': 'xxxx', 'provider_id': 'xxxx', 'INFO-provider_name': 'xxxxx', 'consumer_id': 'xxxx', 'INFO-resp_consumer_name': 'xxxx', 'other_consumers': '', 'INFO-other_consumer_names': '', 'vlan_tag': 'xxxx', 'INFO-vlan_name': '', 'description': '', 'hashtags': '', 'discovery_organization_id': '', 'INFO-discovery_organization_name': 'xxxx', 'discovery_credential_id': '', 'INFO-discovery_credential_name': 'xxxx', 'discovery_scanner_id': '', 'INFO-discovery_scanner_name': 'xxxx', 'discovery_exclude_justification': 'xxxx', 'INFO-Comments-Notes': ''} def display_dict(dictname, level=0): indent = " " * (4 * level) for key, value in dictname.items(): if isinstance(value, dict): print(f'\n{indent}{key}') level += 1 self.display_dict(value, level) else: print(f'{indent}{key}: {value}') if level > 0: level -= 1 display_dict(ipstructure)Results:
Output:name: xxxx
ipv4_start: xxxx
ipv4_cidr: xx
ipv4_address_domain_id: xxxx
INFO-ipv4_address_domain_name: xxxx
ipv4_address_domain_range_id: xxxx
INFO-ipv4_address_domain_range_name: xxxxx
ipv4_allocation_template_id: xxxx
dhcp_relay_id:
ipv6_start: xxxx::
ipv6_cidr: 64.0
ipv6_address_domain_id: xxxx
INFO-ipv6_address_domain_id: xxxxx
ipv6_address_domain_range_id: xxxxx
INFO-ipv6_address_domain_range_name: xxxxxx::/49
ipv6_allocation_template_id: xxxx
dhcpv6_relay_id:
l2_vni_value:
INFO-l2_vni_name:
l2_domain_id:
INFO-l2_domain_name:
dns_domain_id:
INFO-dns_domain_name:
is_infoblox_synced: xxxx
is_private: xxxx
tenant_id: xxxx
INFO-tenant_name: xxxx
partition_id: xxxx
INFO-partition_name: xxxx
provider_id: xxxx
INFO-provider_name: xxxxx
consumer_id: xxxx
INFO-resp_consumer_name: xxxx
other_consumers:
INFO-other_consumer_names:
vlan_tag: xxxx
INFO-vlan_name:
description:
hashtags:
discovery_organization_id:
INFO-discovery_organization_name: xxxx
discovery_credential_id:
INFO-discovery_credential_name: xxxx
discovery_scanner_id:
INFO-discovery_scanner_name: xxxx
discovery_exclude_justification: xxxx
INFO-Comments-Notes: