KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a list of floats in python: a = [1.2, 2.9, 7.4] I want to join them to produce a space-separated string - ie.: 1.2 2.9 7.4 However, when I try: print " ".join(a) I get an error because they're floats, and when I try: print " ".join(str(a)) I get [ 1 . 2 , 1 . 8 , 5 . 2 9 9 9 9 9 9 9 9 9 9 9 9 9 9 8 ] How can I join all of the elements, while converting the elements (individually) to strings, without having to loop through them all?
Tags (comma-separated)
Save Edits
Cancel