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


Groups > comp.lang.python > #12870

Re: import os or import os.path

References <CAOuJsM=vZL1kLgNkgpD6fC=J3APHJTN2RKLGySD9-p0JnxcpzQ@mail.gmail.com>
Date 2011-09-06 23:49 -0400
Subject Re: import os or import os.path
From Joe Riopel <goon12@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.820.1315367376.27778.python-list@python.org> (permalink)

Show all headers | View raw


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.
""

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web