this first post :) my question how can read binary array .txt file matrix? example have such file: 0000010101010 1101010101000 0010010010000 0000000000000 . . . and copy data matrix this: [[0,0,0,0,0,1,0,1,0,1,0,1,0], [1,1,0,1,0,1,0,1,0,1,0,0,0], [0,0,1,0,0,1,0,0,1,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0]] my problem i'm not using separator bits (a part of \n each line). do this:- open('new.txt') f: l = [map(int, line.strip()) line in f] print l output:- >>> [[0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]