I want to convert a = [1,2,3,4,5] into a_string = "1 2 3 4 5". The real numpy array is quite big (50000x200) so I assume using for loops is too slow.
a = [1,2,3,4,5]
a_string = "1 2 3 4 5"
for loops
You can use the join method from string:
join
>>> a = [1,2,3,4,5] >>> ' '.join(map(str, a)) "1 2 3 4 5"
1.4m articles
1.4m replys
5 comments
57.0k users