The last time I used a string format parameter in Python and encountered an operator priority problem, it took a long time to find the problem and record it here.
Two variables were defined at the time:
Datacenter = Int (sys.argv[1= Int (sys.argv[2])
This means that both datacenter and client are of type int. And then call the following sentence when the error occurs.
Dc_net = Self.addswitch ('s%d' % datacenter+client+1)
Hint can not be str and int splicing, but I thought clearly datacenter and client are int, want to add up why say can't splicing it.
Later analysis should be the priority of the problem, the above sentence by default, the%d parameter is set to datacenter, then this sentence becomes a str+int+1 form, will naturally error.
So it's better to do this:
Dc_net = Self.addswitch ('s%d' % (datacenter+client+1))
"Python" questions about the format parameters of Python