[Python]不定长矩阵转置
来源:互联网 发布:注册域名是什么意思 编辑:程序博客网 时间:2024/06/01 09:54
# transpose matrix even length of lines is differentdef transpose(matrix): maxLineLen = 0 tLine = [] tMatrix = [] # compute max length in lines for i in matrix: if maxLineLen < len(i): maxLineLen = len(i) # transpose matrix for i in range(0,maxLineLen): for j in matrix: # prevent out of index if i <= len(j) - 1: tLine.append(j[i]) tMatrix.append(tLine[:]) del(tLine[:]) return tMatrixtest = [['z', 'r', 'p'], ['z', 'x', 's', 'a']]print transpose(test)
0 0
- [Python]不定长矩阵转置
- Python的不定长参数
- Python函数的不定长参数
- Python的不定长参数研究
- python学习记录---不定长参数
- Python函数的不定长参数
- Java的不定长参数和Python的不定长参数对比
- python学习六(类、不定长参)
- Python 不定长函数 (函数可变参数个数)
- 不定长参数测试
- TVarRec不定长数组
- 不定长数组:vector
- 不定长参数
- java不定长参数
- 不定长顺序表
- Java不定长参数
- 不定长数组 vector
- 不定长参数
- C++函数重定义、重载、重写
- Web前端最得力的网站
- Swift 中的floor()函数 用途
- webdriver中启动ie/火狐/谷歌
- Android 数据存储
- [Python]不定长矩阵转置
- 彻底理解ThreadLocal
- 调用opencv库进行身份证号码识别主要流程
- git原理及使用
- C++封装、继承、多态
- Eclipse->Run On Server 错误:Project facet Java version 1.7 is not supported.
- Android学习历程2
- SQL 执行错误 # 1005 从数据库的响应
- 常用Xcode插件推荐(持续更新)