当前位置:网站首页>数组旋转
数组旋转
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
边栏推荐
猜你喜欢

Substring Inversion (Easy Version)

Solution to the trial of ycu Blue Bridge Cup programming competition in 2021

SQL -- data filtering and grouping

几行代码教你爬取LOL皮肤图片

Generation of verification code

Completely clean up MySQL win

SQL -- data definition
![[leetcode 54] spiral matrix](/img/c0/9a55a62befb783a5bfc39dc3a96cb2.png)
[leetcode 54] spiral matrix

Basic knowledge of network in cloud computing

Addition, deletion, query and modification of data
随机推荐
[leetcode 459] duplicate substring
Explanation of the second I interval of 2020 Niuke summer multi school training camp
Type conversion in C #
[leetcode 19] delete the penultimate node of the linked list
渔网道路密度计算
Common sense of thread pool
Substring Inversion (Easy Version)
D. Optimal partition segment tree optimization DP
Completely clean up MySQL win
Failure to deliver XID in Seata distributed transaction project
Gesture recognition research
Export the articles written in CSDN to PDF format
识别验证码
7-21日错题涉及知识点。
用C语言实现重写strcmp等四个函数
Advanced operation of idea debug
Rust的闭包类型(Fn, FnMut, FnOne的区别)
Conversion between JS object and string
Record the installation and configuration of gestermer on TX2, and then use GST RTSP server
xlsxwriter.exceptions.FileCreateError: [Errno 13] Permission denied问题