[Tutor] cd reader
Gregor Lingl
glingl@aon.at
Mon Nov 25 14:38:02 2002
Chris Avery schrieb:
>Hello all,
>I need to write a program that'll read the contents of a CD and write
>the filenames to a file for printing.
>
>Where should I start?
>
Where are you? I think you can't start elsewhere.
If you tell us where you are, perhaps we can recommend
how to continue.
If you are, accidentally, in IDLE (or PythonWin)
- try something like the following:
>>> import os
>>> os.getcwd()
'C:\\Py4Kids'
>>> os.listdir(os.getcwd())
['kap01', 'kap02', 'kap03', 'kap04', 'kap05', 'kap06', 'kap07', 'kap09']
>>> os.chdir('kap09')
>>> os.listdir(os.getcwd())
['laufzeit.py', 'quadrat.py', 'reihe.py']
>>>
if you deed more information about module os, look at
http://www.python.org/doc/current/lib/os-file-dir.html
Regards, Gregor
>
>Thanks,
>Chris
>
>
>
>_______________________________________________
>Tutor maillist - Tutor@python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>
>
>