二维数据结构 [英] 2-dimensional data structures

查看:100
本文介绍了二维数据结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

再次问好 - 这是一个新手...


我想在数独的野蛮人身上工作,只是为了好玩。


我正在考虑不同的策略,但首先我需要决定用于进度/解决方案网格的

数据结构。


这是一个正方形,我会在80年代的青少年时期使用一个9x9的二维阵列,使用BASIC。


什么是在python中存储数据的等效方法? - 这对我来说并不是很明显

如何用列表来做这件事。


''因为我很厚 - 但给我一点指针其余的我会做


Hello again - rather a newbie here...

I want to work on a sudoku brute-forcer, just for fun.

I am considering different strategies, but first I need to decide on the
data-structure to use for the progress/solution grid.

This being a square, I would have used a 9x9 2-dimensional array in my
teenage years back in the 80''s, using BASIC.

What is the equivalent way to store data in python? - It isn''t obvious
to me how to do it with lists.

''scuse me for being thick - but give me a little pointer and I will do
the rest.

推荐答案

anthonyberet写道:
anthonyberet wrote:
你好再次 - 而不是这里的新手...

我想在一个数独的野蛮人身上工作,只是为了好玩。

我正在考虑不同的策略,但首先我需要决定用于进度/解决方案网格的
数据结构。

这是一个正方形,我会在我的青少年时期使用9x9二维数组在80年代,使用BASIC。

在python中存储数据的等效方法是什么? - 对我来说,如何用列表来做这件事并不是很明显。]

好​​吧,你可以做一个列表列表,或元组元组,或者

组合。


例如:

val =矩阵[indexA] [indexB]


-carl''对我来说很厚 - 但给我一个小指针,我会做其余的。
Hello again - rather a newbie here...

I want to work on a sudoku brute-forcer, just for fun.

I am considering different strategies, but first I need to decide on the
data-structure to use for the progress/solution grid.

This being a square, I would have used a 9x9 2-dimensional array in my
teenage years back in the 80''s, using BASIC.

What is the equivalent way to store data in python? - It isn''t obvious
to me how to do it with lists.]
Well, you could do a list of lists, or a tuple of tuples, or a
combination thereof.

For example:
val = matrix[indexA][indexB]

-carl ''scuse me for being thick - but give me a little pointer and I will do
the rest.



-

Carl J. Van Arsdall
cv ********* @ mvista。 com

构建和发布

MontaVista软件


--

Carl J. Van Arsdall
cv*********@mvista.com
Build and Release
MontaVista Software


anthonyberet写道:
anthonyberet wrote:
你好再说一次 - 而不是这里的新手...

我想在一个数独的野蛮人身上工作,只是为了好玩。


我知道你的意思。我也写了一个只是为了好玩。

我正在考虑不同的策略,但首先我需要决定用于进度/解决方案网格的数据结构。

这是一个正方形,我会在80年代的青少年时期使用一个9x9的二维阵列,使用BASIC。

等价物是什么在python中存储数据的方法? - 对我来说,如何用清单做这件事并不是很明显。
Hello again - rather a newbie here...

I want to work on a sudoku brute-forcer, just for fun.
I know what you mean. I wrote one just for fun too.
I am considering different strategies, but first I need to decide on the
data-structure to use for the progress/solution grid.

This being a square, I would have used a 9x9 2-dimensional array in my
teenage years back in the 80''s, using BASIC.

What is the equivalent way to store data in python? - It isn''t obvious
to me how to do it with lists.




列表清单。

一个清单有9个元素,每个元素都是9个数字的列表。

[[5,2,7,3,9,8,1,4,6],

[3,1,4,....],

....

]


干杯,

Carl。



List of lists.
One list with nine elements, each of which is a list with nine numbers.
[[5,2,7,3,9,8,1,4,6],
[3,1,4,....],
....
]

Cheers,
Carl.


anthonyberet写道:
anthonyberet wrote:
你好再说 - 而不是这里的新手...
<我想开发一个数独的暴力破坏者,只是为了好玩。

我正在考虑不同的策略,但首先我需要决定使用的数据结构进展/解决方案网格。

这是一个正方形,我会在80年代的青少年时期使用一个9x9的二维数组,使用BASIC。 />
在python中存储数据的等效方法是什么? - 对我来说,如何用清单来做这件事并不是很明显。

''对不起我 - 但是给我一个小指针我会做的
其余的。
Hello again - rather a newbie here...

I want to work on a sudoku brute-forcer, just for fun.

I am considering different strategies, but first I need to decide on the
data-structure to use for the progress/solution grid.

This being a square, I would have used a 9x9 2-dimensional array in my
teenage years back in the 80''s, using BASIC.

What is the equivalent way to store data in python? - It isn''t obvious
to me how to do it with lists.

''scuse me for being thick - but give me a little pointer and I will do
the rest.




可能是数字模块:

http://numeric.scipy.org/


但你也可以做嵌套列表。

Larry Bates



Probably the numeric module:

http://numeric.scipy.org/

But you can also do nested lists.

Larry Bates


这篇关于二维数据结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆