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>You <em>can</em> put pretty much whatever you want in a list.  It's likely that your <code>sys.argv</code> is too long (even after slicing off the first element).</p>

<p>e.g. if <code>len(sys.argv[1:]) == 6</code> and <code>len(i) == 5</code> than by the time you get to the last element in the <code>for</code> loop, <code>i</code> will be empty.  This appears to be the case from the code you posted in the link.</p>

<p>Also note that you're probably better off using <code>zip</code>:</p>

<pre><code>lst = ['.','.','.',':','']
for v, ii in zip(sys.argv[1:], lst):  # possibly reversed(i) if you meant to pop off the left side of the list rather than the end?
    host += host + str(v)+ str(ii)
</code></pre>

<p>Or (more efficiently):</p>

<pre><code>host = ''.join(j+ii for j, ii in zip(sys.argv[1:], lst))
</code></pre>

<p>Of course, you still likely end up with incorrect output (even with <code>zip</code>) if the input lists aren't the correct lengths -- However, you won't get an exception, just a shorter output string than you might be expecting since <code>zip</code> truncates when one of the iterables is exhausted.</p>

python