Learning Python - Have Question.

iapain iapain at gmail.com
Sat Aug 26 17:12:24 EDT 2006


> I'm just learning Python, and I have a question about os.path.join(dirpath,
> name) and its use.  Simply put, I haven't figured out how to use it.

First thing you have to remember while using python is "everything is
an object". os.join.path concatenates one or more path for example
os.path.join("c:", "myfolder") represent a path relative to current dir
on c: drive.

> I was looking through the Python reference material in the wee hours of the
> morning and checking out some of the modules.  I was keenly interested in
> the os module, as it is necessary for me to learn this stuff in order to
> begin my first real Python project.

Dont worry Python is quite easy to learn, just keep on coding in
python.

> Oh, I have one more question.   So far everything that I've played with
> yields only the filename of file.  I am aware that os.walk will place the
> pathnames and filenames in a tuple, but I'm wondering if there is a way to
> input a full path directory from within Python.  Specifically, I want to be
> able to get directories like one would get by entering "ls -l" at a *nix
> shell prompt.

you could easily do it with python. Its more than your expectation. The
best would be to call os.system(shell cmd). You can also print tuple in
your own way.

Cheers!
Deepak




More information about the Python-list mailing list