Hello,
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:
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)
The output I get is:
[0, 1, 2]
Any help would be appreciated. Thanks
I was returning the list as well as ID2. This was causing the problem. Sorry about this.
The code is now working. Thanks