0

I have this simple python 3.x code:

str = "{} ({}) is already aliased to {} ({})".format(nodeName, node['ipAddress']), n2['dnsName'], n2['ipAddress'])

All 4 arguments to format() are string, but I get this error:

str = "{} ({}) is already aliased to {} ({})".format(nodeName, node['ipAddress'], n2['dnsName'], n2['ipAddress'])
ValueError: zero length field name in format

If I print node['ipAddress'] and node['dnsName'] manually using just print(), I see this:

dnsName = yuckyre.foobar.com

ipAddress = 192.168.1.10
<type 'str'>

Not sure why " appears". Maybe that's a clue to the problem?

Pepster K.
  • 339
  • 2
  • 5
  • 17

0 Answers0