python: zip 与 * 探究
来源:互联网 发布:js获取传入的参数 编辑:程序博客网 时间:2024/05/29 16:21
结论
因为之前对python中的 zip 和 * ,搞得不是很清楚,这次做项目时又遇到这个问题,所以上网查阅,并经过自己编写代码进行实验,得出以下结论:
附上自己写的实验源码
import numpy as npa = np.zeros(shape=[3, 5, 6], dtype=np.int)print np.shape(a), ':', type(a)for b in a: print np.shape(b)printprint np.shape(zip(a)), ':', type(zip(a))for b in zip(a): print np.shape(b)printprint np.shape(zip(zip(a))), ':', type(zip(zip(a)))for b in zip(zip(a)): print np.shape(b)printprint np.shape(zip(*a)), ':', type(zip(*a))for b in zip(*a): print np.shape(b)
(3, 5, 6) : <type 'numpy.ndarray'>(5, 6)(5, 6)(5, 6)(3, 1, 5, 6) : <type 'list'>(1, 5, 6)(1, 5, 6)(1, 5, 6)(3, 1, 1, 5, 6) : <type 'list'>(1, 1, 5, 6)(1, 1, 5, 6)(1, 1, 5, 6)(5, 3, 6) : <type 'list'>(3, 6)(3, 6)(3, 6)(3, 6)(3, 6)Process finished with exit code 0
阅读全文
1 0
- python: zip 与 * 探究
- python与zip文件格式
- Python中的zip()与*zip()函数详解
- Python 中的input(),raw_input()与zip()
- python zip() zip(*arg)
- python ctypes 探究 ---- python 与 c 的交互
- python ctypes 探究 ---- python 与 c 的交互
- python zip()
- python zip
- Python ZIP
- python zip
- python zip
- zip() python
- python zip( )
- python zip
- Python: 探究py2与py3除法的区别
- Python checkio Transposed Matrix map与zip的使用
- Python信贷数据处理与初步分析(ZIP解压)
- python文件常用操作
- Mac下配置虚拟主机
- Android Studio创建项目
- UI automator的使用
- 这里写一个小文章
- python: zip 与 * 探究
- spring集成mybatis后,打印SQL语句
- 堆排序
- 在Android项目上集成Google语音(不使用手机自带引擎)
- 详解MindManager之提醒功能
- 秒杀系统架构优化思路
- eclipse中Pull代码报错checkout conflict with files的解决方法
- 如何使用rem
- 记录一次大对象导致的Java堆内存溢出问题