I tried doing:
str = ""
"".join(map(str, items))
but it says str object is not callable. Is this doable using a single line?
Use string join() method.  
List:
>>> l = ["a", "b", "c"]
>>> " ".join(l)
'a b c'
>>> 
Tuple:
>>> t = ("a", "b", "c")
>>> " ".join(t)
'a b c'
>>> 
Non-string objects:
>>> l = [1,2,3]
>>> " ".join([str(i) for i in l])
'1 2 3'
>>> " ".join(map(str, l))
'1 2 3'
>>> 
                        The problem is map need function as first argument.
Your code
str = ""
"".join(map(str, items))
Make str function as str variable which has empty string.
Use other variable name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With