当前位置:网站首页>数组旋转
数组旋转
2022-04-23 05:47:00 【峰爷520】
import numpy as np
l = np.arange(1, 17, dtype='int16')
l.shape = (4, 4)
print(l)
print()
f1 = lambda x:np.array(list(zip(*l)))
l1 = f1(l)
print(l1)
print()
# 顺时针旋转90度
f2 = lambda x:np.array(list(zip(*l[::-1])))
l2 = f2(l)
print(l2)
print()
# 逆时针旋转90度
f3 = lambda x:np.array(list(zip(*map(lambda x:x[::-1], l))))
l3 = f3(l)
print(l3)
版权声明
本文为[峰爷520]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_41752427/article/details/81072694
边栏推荐
猜你喜欢
SQL -- data filtering and grouping
SQL sorts according to the specified content
Substring Inversion (Easy Version)
[leetcode 401] binary Watch
Addition, deletion, modification and query of MySQL table
Definition of C class and method
P1586 solution to tetragonal theorem
从源代码到可执行文件的过程
Basic knowledge of network in cloud computing
Completely clean up MySQL win
随机推荐
C array
Techniques et principes de détection
识别验证码
Rust: Tcp 服务器与客户端的一个简单例子
爬取手游网站游戏详情和评论(MQ+多线程)
Solution to the trial of ycu Blue Bridge Cup programming competition in 2021
Event listener
Option的正确打开方式
Installation and usage skills of idea
爬取小米有品app商品数据
Cf1427c the hard work of paparazzi
Robocode教程4——Robocode的游戏物理
[leetcode 401] binary Watch
Database - sorting data
Feign请求日志统一打印
用二进制进行权限管理
SVN简单操作命令
用C语言实现重写strcmp等四个函数
POI and easyexcel exercises
Basemap库绘制地图