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


Groups > comp.lang.python > #12870

Re: import os or import os.path

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <goon12@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'case.': 0.15; "it'": 0.16; 'practice?': 0.16; 'subject:import': 0.16; '\xa0print': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.16; 'received:74.125.82.174': 0.19; 'received:mail- wy0-f174.google.com': 0.19; 'cc:2**0': 0.22; 'header:In-Reply- To:1': 0.22; 'tue,': 0.23; 'module,': 0.23; 'sep': 0.23; 'noticed': 0.24; 'pm,': 0.24; 'import': 0.28; 'importing': 0.29; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.30; 'module': 0.30; 'hi,': 0.32; 'source': 0.33; 'instead': 0.33; 'received:74.125.82': 0.38; 'received:google.com': 0.38; 'subject:: ': 0.39; 'help': 0.39; 'received:74.125': 0.39; 'description': 0.39; "it's": 0.40; 'skip:o 30': 0.63; 'said:': 0.67
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=MG+zwLuw+EDxuXTBmytcDQtQ6NvlRoeH8dsIlQT7m6M=; b=IQXvvzQMCgb4ichCRDaEXKDqHUb+n6jfjYFJ+slUPTMoA2OFaP9DbpqgVI7ac/T090 PofevW+UKEqOyFRKX74R7N8hlHh7CCFnXdv7UwQWgk/EU+4Xbaucma60pYG0tgNQqCYL VUubNi1ek2VhJWyj32hnCgVXUN2CiSOIhFYEc=
MIME-Version 1.0
In-Reply-To <CAOuJsM=vZL1kLgNkgpD6fC=J3APHJTN2RKLGySD9-p0JnxcpzQ@mail.gmail.com>
References <CAOuJsM=vZL1kLgNkgpD6fC=J3APHJTN2RKLGySD9-p0JnxcpzQ@mail.gmail.com>
Date Tue, 6 Sep 2011 23:49:34 -0400
Subject Re: import os or import os.path
From Joe Riopel <goon12@gmail.com>
To Jabba Laci <jabba.laci@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc Python mailing list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.820.1315367376.27778.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1315367376 news.xs4all.nl 2472 [2001:888:2000:d::a6]:56711
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:12870

Show key headers only | 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