custom split function
Fernando PĂ©rez
fperez528 at yahoo.com
Tue Dec 25 18:44:44 EST 2001
I.J. wrote:
> Hi
> Is there a way to spit file content into list of individual
> bytes/characters.
> I know it could be done with substring manipulation but I hope there is more
> direct way.
> Bye
file = open('filename')
file_as_string = file.read()
Now you have your whole file in a string, which for most purposes can be
thought of as a list of characters. And you can always do
file_as_list = list(file_as_string)
if you really want it as a list.
hth,
f
More information about the Python-list
mailing list