Let's say I have the result of a list:
['_', '_', '_', '_', '_', '_', '_']
How can I turn it into this?:
['_ _ _ _ _ _ _']
Or even in a variable with the value above
Let's say I have the result of a list:
['_', '_', '_', '_', '_', '_', '_']
How can I turn it into this?:
['_ _ _ _ _ _ _']
Or even in a variable with the value above
You can use join
and then transform its return into an array of a single element.
separator = ' '
array = ['_', '_', '_', '_', '_', '_', '_']
result = [separator.join(array)]
print(result)
The print will be:
['_ _ _ _ _ _ _']
You can also use this to get fewer rows.
array = ['_', '_', '_', '_']
result = [' '.join(array)]
print(result)
Result:
['_ _ _ _']