Operating environment
Xeon E5-2620 v4 (8 cores) x 2
32GB RAM
CentOS 6.8 (64bit)
openmpi-1.8.x86_64 and its-devel
mpich.x86_64 3.1-5.el6 and its-devel
gcc version 4.4.7 (And gfortran)
NCAR Command Language Version 6.3.0
WRF v3.7.Use 1.
Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
Python 3.6.0 on virtualenv
I'm trying to do the title.
http://qiita.com/7of9/items/4aa9f546a4ff1bf2e1aa I was taught various methods in the comments.
Separately, I found the following. http://stackoverflow.com/questions/15968017/formatting-a-tuple-of-floats
I implemented this.
test_python_170324b.py
import numpy as np
atuple = (3., 1., 4., 1., 5., 9., 2., 6., 5., 3., 5.)
astr=','.join(format(elem, '.5f') for elem in atuple)
print(astr)
result
$ python test_python_170324b.py
3.00000,1.00000,4.00000,1.00000,5.00000,9.00000,2.00000,6.00000,5.00000,3.00000,5.00000
There seem to be various ways to do it, and I'm considering what I can use "in the sky" (and what is highly readable).
(Addition 2017/03/24)
I think @ shiracamus's Comment is simpler and easier to read.
Thank you for the information.
Recommended Posts