Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. import json
  2. a = [1.2, 2.9, 7.4]
  3. str = "t".join(format(x,"10.3f") for x in a)
  4. print json.dumps(str)
  5.  
  6. " 1.200t 2.900t 7.400"
  7.  
  8. "1.200t2.900t7.400"
  9.  
  10. s = "t".join(format(x, "10.3f").strip() for x in a)
  11.  
  12. import json
  13. a = [1.2, 2.9, 7.4]
  14. s = "t".join(format(x, "10.3f").strip() for x in a)
  15. print json.dumps(s) # "1.200t2.900t7.400"
  16.  
  17. str = "t".join(format(x,"0.3f") for x in a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement