赞
踩
对于.npy文件,可以使用代码打开
- import numpy as np
- test = np.load('test.npy', encoding = 'latin1')
- print(test)
对于.pkl文件,可以使用代码打开
- import pickle as pkl
- f = open('test.pkl', 'rb')
- b = p.load(f)
- b = list(b)
- b = np.array(b)
- print(b)
对于正常文件,使用代码打开
- 1)
- import json
- with open("test.json") as f:
- text = f.read()
-
- t = json.loads(text)
- print(t)
-
- 2)
- f = open("test.json", encoding = 'utf-8')
- text = f.read()
- f.close()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。