variables formatting using python script
<p>I'm having issues formatting my variables. My PORT1 and PORT2 are not working properly. I'm getting syntax errors. What I'm doing wrong.  Thank you for the inputs.</p>

<pre><code>import socket
import os
import netifaces
NICS = netifaces.interfaces()
PORT1 = NICS[1]
PORT2 = NICS[2]
os.system("nmcli con add type team-slave con-name team0-port1 ifname {}".format(PORT1)) master team0)
os.system("nmcli con add type team-slave con-name team0-port2 ifname {}".format(PORT2)) master team0)
</code></pre>

<p>Error:</p>

<pre><code>os.system("nmcli con add type team-slave con-name team0-port1 ifname {}".format(PORT1)) + master team0)
                                                                                                         ^
SyntaxError: invalid syntax
</code></pre>

<p>Your problem that you are trying to append string <code>master team0</code> but you didn't wrap that in quotes also there one more closing bracket than opening ones</p>

<p>I thin this is what it should be</p>

<pre><code>os.system("nmcli con add type team-slave con-name team0-port1 ifname {} master team0".format(PORT1))
</code></pre>

python