custom split function

Fernando Pérez fperez528 at
Wed Dec 26 00:44:44 CET 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 =

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.



More information about the Python-list mailing list