python3.8
1. 앞뒤 간격 한칸씩 주기
>>> import numpy as np
>>> x=np.arange(0,0.4,0.0008)
>>> np.savetxt('test.dat', x, fmt=' %.4f ')
>>> exit()
2. 앞뒤 특정 문자 채우기
>>> import numpy as np
>>> x=np.arange(0,0.4,0.0008)
>>> np.savetxt('test.dat', x, fmt='{:*^20}'.format('% .4f '))
>>> exit()
참고글
https://www.delftstack.com/ko/howto/numpy/python-save-and-load-numpy-array/
Python에서 NumPy 배열 저장 및로드
Python에서 NumPy 배열을 저장하고로드하는 3 가지 메서드, numpy.savetxt() 및 numpy.loadtxt() 함수, numpy.tofile() 및 numpy.fromfile() 함수, numpy.save() 및 numpy.load() 함수.
www.delftstack.com
https://docs.python.org/3/library/string.html#format-specification-mini-language
string — Common string operations — Python 3.9.6 documentation
string — Common string operations Source code: Lib/string.py String constants The constants defined in this module are: string.ascii_letters The concatenation of the ascii_lowercase and ascii_uppercase constants described below. This value is not locale-
docs.python.org