报错求助:NameError: name 'List' is not defined [Finished in 1.6s]

PythonJJJ 2019-07-15 11:16:34
class Solution:
def power(self, matrix: List[List[int]]) -> List[int]:
if not matrix : return []
res = []
while matrix:
res.extend(matrix.pop(0))
next_matrix = []
for x in zip(*matrix):
next_matrix.append(x)
matrix = next_matrix[::-1]
return res
matrix = [[1,2,3],[4,5,6],[7,8,9]]
Solusion().power(matrix)
print(Solusion().power(matrix))

感谢大神

...全文
844 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
from typing import List

37,721

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧