I have a giant list of lists that I imported from a file like this:
letters = []
for i in range(len(string)):
let = []
for j in range(7):
line = infile.readline()
let = let + [line]
letters.append(let)
infile.readline()
Its a big list of lists, but each secondary list has a \n at the end of it.
[[' ### \n', ' ## ## \n', ' ## ## \n', '## ##\n',
'#########\n', '## ##\n', '## ##\n'], ['######## \n',
'## ##\n', '## ##\n', '######## \n', '## ##\n',
'## ##\n', '######## \n'], ... ]]
How do I remove the \n? so its just
[[' ### ', ' ## ## ', ' ## ## ', '## ##',
'#########', '## ##', '## ##'], ['######## ',
'## ##', '## ##', '######## ', '## ##',
'## ##', '######## '], ... ]]
It's important to have the spaces in there as well. I've tried doing
letters.strip("\n")
but that didnt work.
Please help!
EDIT: I think it might be a problem with the
line = infile.readline()
but I'm not sure how to fix it.
My desired output is
### ####### ########
but instead i'm getting this
###
#######
########