Storing list variables as a string and storing it as a variable
<p>I am trying to enter list items into a string. I then want to store the string as a variable and print it out in another function. The code I have got so far is:</p>

<pre><code>def b(): 

    ID = [0, 1, 2]
    ID2 = 'ID={0}.{1}.{2}'.format(*ID) 
    return ID2 

if __name__ == '__main__': ID2 = b() 


def c(ID2): 
    print ID2 

if __name__ == '__main__': myObject = c(ID2) 
</code></pre>

<p>The output I get is:</p>

<pre><code>[0, 1, 2] 
</code></pre>

<p>Any help would be appreciated. Thanks</p>

<p>I was returning the list as well as ID2. This was causing the problem. Sorry about this.</p>

<p>The code is now working. Thanks</p>
