Python
AIWCZ
这个作者很懒,什么都没留下…
展开
-
Python 输出图像像素,显示不全的解决
在import包后,加上这一行,完事。np.set_printoptions(threshold=np.inf)原创 2021-11-05 16:09:43 · 1020 阅读 · 0 评论 -
Python 判断列表中元素是否完全相同
将列表转换成集合即可a = [0,0,0,0]b = set(a) # {0}if len(b) == 1: # 1 print('True')原创 2021-11-05 10:26:43 · 2900 阅读 · 1 评论 -
Python 删除文件夹及其中所有文件
os只能删除empty的文件夹。因此:import shutilshutil.rmtree(dirpath)原创 2021-11-04 15:57:41 · 569 阅读 · 0 评论 -
Python中List、numpy.array与torch.Tensor 之间的相互转化
list 与 numpy①list → numpyarray = np.array(list)②numpy → listlist = array.tolist()torch.Tensor 与 numpy①torch.Tensor → numpyarray = tensor.numpy()②numpy → listtensor = torch.from_numpy(array)list 与 torch.Tensor①list → tensortensor = torch.Ten原创 2021-11-04 11:17:14 · 305 阅读 · 0 评论 -
用Python对.mat文件进行读取
import scipy.io as sciodataFile='data/WILLOW-ObjectClass/Car/Cars_000a.mat'data=scio.loadmat(dataFile)print(data)原创 2021-10-24 20:52:07 · 258 阅读 · 0 评论 -
python中lower()函数
lower()函数将字符串中的所有大写字母转换为小写字母。原创 2021-10-24 17:41:55 · 379 阅读 · 0 评论