我有一个这样的文本文件:
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
1100111100111100111100111100111100111100
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
我如何把它变成:
[
[1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,0],
[1100111100111100111100111100111100111100],
[0000000000000000000000000000000000000000],
[0000000000000000000000000000000000000000],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[0000000000000000000000000000000000000000],
[0000000000000000000000000000000000000000],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[0000000000000000000000000000000000000000],
[0000000000000000000000000000000000000000],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[0000000000000000000000000000000000000000],
[0000000000000000000000000000000000000000],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[0000000000000000000000000000000000000000],
[0000000000000000000000000000000000000000],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[0000000000000000000000000000000000000000],
[0000000000000000000000000000000000000000],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[1100111100111100111100111100111100111100],
[0000000000000000000000000000000000000000],
[0000000000000000000000000000000000000000]
]
我试过的代码是
content = open('filename').readlines;
for line in content:
for c in line:
if c in "\n":