Break string into list of characters in Python [duplicate]
Strings are iterable (just like a list).
I'm interpreting that you really want something like:
fd = open(filename,'rU')chars = []for line in fd: for c in line: chars.append(c)
or
fd = open(filename, 'rU')chars = []for line in fd: chars.extend(line)
or
chars = []with open(filename, 'rU') as fd: map(chars.extend, fd)
chars would contain all of the characters in the file.