0

I am newbie to python so please ignore if this is stupid. Here, I am getting Invalid syntax while printing the data in some specified format.

with open("ip_services.xyz", "w") as handle:
    for service in sorted(...some functionality...)):
        print("ip_server(\"{}\", {}, {}, {}, {}, {}, {}) # {}, {}".format(
            service.address, service.port, 1 if service.udp else 0,
            service.service_id, service.instance_id,
            service.major_version, service.minor_version,
            service.xyz,
            service.service_name),
              file=handle)

Error is like :-

  File "producer.py", line 220
    print("{} = \"{}\" # {}".format(signal, value, label), file=handle)
                                                               ^
SyntaxError: invalid syntax
Ozgur Vatansever
  • 49,246
  • 17
  • 84
  • 119
Pawankumar Dubey
  • 387
  • 1
  • 6
  • 21

0 Answers0