Join float list into space-separated string in Python

You need to convert each entry of the list to a string, not the whole list at once:

print " ".join(map(str, a))

If you want more control over the conversion to string (e.g. control how many digits to print), you can use

print "".join(format(x, "10.3f") for x in a)

See the documentation of the syntax of format specifiers.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)