Learning Python - Have Question.

AlbaClause you at cogeco.ca
Sat Aug 26 16:45:18 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.

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.

I was looking at os.walk(top) when I read a little blurb about using
os.path.join(dirpath, name) to get complete directory listings with
path/filname.  Unfortunately, I was unable to figure out how to use it.   I
kept getting an error with a message something like "b.startswith" or
something like that.  I was also unable to find any other information about
this in the reference material.

If someone could offer some insight into the use of os.path.join(dirpath,
name), I would really appreciate it.

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.

Thanks.

-- 
--
There are several things that I will never be:
  *  I will never be attracted to females.
  *  I will never enjoy the company of others.
Exactly how these realities bode for my enemy, is not of my concern.




More information about the Python-list mailing list