赞
踩
1.矩阵转置,输入一个4行5列的矩阵并转置
- a = []
- #行数控制
- for i in range(4):
- a.append([])
- #列数控制
- for j in range(5):
- print('第'+str(i+1)+'行,第'+str(j+1)+'列')
- a[i].append(int(input('请输入整数:')))
- print(a)
-
- result = []
- for i in range(5):
- item = []
- for j in range(4):
- item.append(a[j][i])
- result.append(item)
- print(result)
2.按照姓名排序,有如下一份数据,按照姓名排序。
- from xpinyin import Pinyin
- content = []
- with open ('score.txt','r',encoding='utf-8') as f:
- for line in f.readlines():
- content.append(line.replace('\n',''))
- content = content[1:]
- print(content)
- n
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。