pythonfliplr
时间: 2023-08-27 20:20:50 浏览: 84
Python中的`np.fliplr`函数用于左右翻转数组。它接受一个二维数组作为参数,并返回一个左右翻转后的新数组。以下是一个示例代码:
```python
import numpy as np
array = np.arange(8).reshape((2, 2, 2))
print("Original array:\n", array)
flipped_array = np.fliplr(array)
print("\nFlipped array left-right:\n", flipped_array)
```
上述代码的输出结果为:
```
Original array:
[[[0 1]
[2 3]]
[[4 5]
[6 7]]]
Flipped array left-right:
[[[2 3]
[0 1]]
[[6 7]
[4 5]]]
```
可以看到,原始数组`array`被左右翻转后得到了新的数组`flipped_array`。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [python:np.fliplr()](https://blog.csdn.net/yql_617540298/article/details/89453171)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Python: numpy.fliplr()](https://blog.csdn.net/Sarah_LZ/article/details/86558029)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文