Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #12870 > unrolled thread

Re: import os or import os.path

Started byJoe Riopel <goon12@gmail.com>
First post2011-09-06 23:49 -0400
Last post2011-09-06 23:49 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: import os or import os.path Joe Riopel <goon12@gmail.com> - 2011-09-06 23:49 -0400

#12870 — Re: import os or import os.path

FromJoe Riopel <goon12@gmail.com>
Date2011-09-06 23:49 -0400
SubjectRe: import os or import os.path
Message-ID<mailman.820.1315367376.27778.python-list@python.org>
On Tue, Sep 6, 2011 at 5:25 PM, Jabba Laci <jabba.laci@gmail.com> wrote:
> Hi,
>
> If I want to use the 'os.path' module, it's enought to import 'os':
>
> import os
> if os.path.isfile('/usr/bin/bash'):
>    print 'got it'
>
> In other source codes I noticed that people write 'import os.path' in
> this case. Which is better practice?

I just followed what the help said:

""
DESCRIPTION
    Instead of importing this module directly, import os and refer to
    this module as os.path.
""

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web