This is probably seriously easy to solve for most of you but I cannot solve this simply putting str() around it can I?
I would like to convert this list: ['A','B','C'] into 'A B C'.
This is probably seriously easy to solve for most of you but I cannot solve this simply putting str() around it can I?
I would like to convert this list: ['A','B','C'] into 'A B C'.
In [1]: L = ['A', 'B', 'C']
In [2]: " ".join(L)
Out[2]: 'A B C'
 
    
    I do not like Python's syntax for joining a list of items, so I prefer to call my own function to perform that task, rather than using Python's syntax in line.
Here is my function:
def joinList(l, c):
    return c.join(l)
myList = ['a', 'b', 'c']
myStrg = joinList(myList, "-")
print myStrg
 
    
    