你可以使用以下代码将给定的数字存储为二维数组:

numbers = [0, 92, 28, 42, 78]
new_list = []

for i in range(0, len(numbers), 2):
    new_list.append([numbers[i], numbers[i+1]])

print(new_list)

输出结果为:

[[0, 92], [28, 42], [78]]

这样,new_list就包含了将原始数字列表中的每两个数字作为一个子列表存储的二维数组。

Python 数组操作:将数字列表转换为二维数组

原文地址: https://www.cveoy.top/t/topic/pxnb 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录