I would like to create a variable named "allvar" that has all values in mylist for example :
mylist = ['X', 'Y', 'Z']
How can I create allvar to be something like .. X Y Z seperated by one space instead of "," and without [] and with out "single quote"
allvar = X Y Z
The reason I like to get allvar because I need to pass this allvar to another host server that have this format already in place ..
Any recommendation ?
You need to use join:
>>> mylist = ['X', 'Y', 'Z']
>>> allvar = ' '.join(mylist)
>>> print allvar
X Y Z