reading from list with paths

Lie Lie.1296 at
Wed Jun 25 21:32:44 CEST 2008

On Jun 26, 1:59 am, antar2 <desoth... at> wrote:
> Hello,
> I would like to  read and print files, of which the complete filepaths
> are
>  mentioned in another textfile. In this textfile (list.txt)  are for
>  example the following paths:
> /data/chorec/chorec-nieuw/s01/S01C001M1/S01C001M1_1LG_f01.TextGrid
>  /data/chorec/chorec-nieuw/s01/S01C001M1/
>  S01C001M1_1LGPseudo_f01.TextGrid
>  /data/chorec/chorec-nieuw/s01/S01C001M1/S01C001M1_AVI1_f01.TextGrid
> I know how to open and read one file in my current directory,
>  but after trying to find this out my self, I give up...

Is this Window's path or Unix-like's path. In Windows, path is
generally like this:
"folder\\data.txt" OR r"folder\data.txt"
because Windows use backslash as its path separator

In Unix-like OS (Unix, Linux, OSX), they use forward slash.

In general, Windows (Explorer) doesn't care whether you used backslash
or forward slash, but I'm not sure if we can use forwardslash in

> I already got one answer for this question, but it did not work

It didn't work... how? Any error message? or what's the content of the
name that should be file object.

> Thanks a lot
> Antar2

More information about the Python-list mailing list