将字符串分解为整数列表的列表

Break a string into list of list of integers

我有这个代码:

content = [line.rstrip('\r\n') for line in open('Ch02/digits/testDigits/0_0.txt')]
content = [[x] for x in content]
content[0][0]

我得到了这个输出:

'00000000000001100000000000000000'

假设我想将此字符串转换为整数列表,例如: [[0],[0],.....,[0]],什么是 pythonic 解决方案?

content = [line.rstrip('\r\n') for line in open('Ch02/digits/testDigits/0_0.txt')]
lst = []
for each in content:
    lst.append([[x] for x in each])
lst = np.array(lst)
lst.reshape(32,32)
s = '001100'

list_of_lists = [[int(ch)] for ch in s]

>> [[0], [0], [1], [1], [0], [0]]