Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- a = [1.2, 2.9, 7.4]
- str = "t".join(format(x,"10.3f") for x in a)
- print json.dumps(str)
- " 1.200t 2.900t 7.400"
- "1.200t2.900t7.400"
- s = "t".join(format(x, "10.3f").strip() for x in a)
- import json
- a = [1.2, 2.9, 7.4]
- s = "t".join(format(x, "10.3f").strip() for x in a)
- print json.dumps(s) # "1.200t2.900t7.400"
- str = "t".join(format(x,"0.3f") for x in a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement