Can't a list have symbols in it?
<p>I have not done python before (only javascript). I am finding the docs alien and the other stackoverflow posts on <code>list.pop()</code> even more cryptic!</p>

<p>my args are <code>'0','0','0','0','0000'</code></p>

<p>here's my code:</p>

<pre><code>i=['.','.','.',':','']

host=''
for v in sys.argv[1:]:
    host=host+str(v)+str(i.pop())
host=host[:-1]

print host
</code></pre>

<p>I'm trying to get <code>'0.0.0.0:0000'</code></p>

<p>But instead I get: <code>IndexError: pop from empty list</code></p>

<p><a href="https://repl.it/DirH/1" rel="nofollow">https://repl.it/DirH/1</a></p>

<p>The reason I ask is that I can't find any SO questions where the list is symbols <strong>and</strong> the list is declared in plain writing!</p>

<p>It seems what you want is simple: join everything using the dot, but the last part, the port number must be joined by colon. Here is another way to do it:</p>

<pre><code>port = sys.argv.pop()
host = '{}:{}'.format('.'.join(sys.argv[1:]), port)
</code></pre>

python