# -*- coding: utf-8 -*-
"""
Created on Wed May 22 10:24:18 2019
@author: User
"""
import numpy as np
m1=np.mat([[1,2,3],[4,5,6]])
print('\nm1:')
print(m1)
np.savetxt('d:\m1.txt', m1)
print('\n np.loadtxt("d:\m1.txt", delimiter=" "):')
m1_reload = np.loadtxt('d:\m1.txt', delimiter=' ')
print(m1_reload)
运行:
m1: [[1 2 3] [4 5 6]]
np.loadtxt("d:\m1.txt", delimiter=" "): [[1. 2. 3.] [4. 5. 6.]]