Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #12854
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.016 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'case.': 0.15; '"import': 0.16; "it'": 0.16; 'practice?': 0.16; 'subject:import': 0.16; '\xa0print': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.16; 'cheers,': 0.18; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'tue,': 0.23; 'versions': 0.23; 'module,': 0.23; 'sep': 0.23; 'noticed': 0.24; 'pm,': 0.24; 'import': 0.28; 'message- id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.30; 'module': 0.30; 'not.': 0.30; 'received:209.85.161.46': 0.31; 'received :mail-fx0-f46.google.com': 0.31; 'hi,': 0.32; 'source': 0.33; 'there': 0.33; 'received:209.85.161': 0.35; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'might': 0.40; "it's": 0.40; 'skip:o 30': 0.63; 'guarantee': 0.66 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=k1lyog6Cy69twnMO3M7u9ZfQFj/rPtzOSgZX/kt4dM8=; b=t21d4Je0Q+XjxUOHPcmThT8FQqu55ZueLHbQtY6/iGTYKYG2kuP2KU3epQEprhyKbk xGQfgJZx4Wvujf1C9l13utYDsZeFPCbuMhiel4ad325cjYhARWO+9EnOR+yuEuiO4giy kT6J1m/sRfcVFOwe4PJy4px/hLPnCSGK/TBak= |
| MIME-Version | 1.0 |
| In-Reply-To | <CAOuJsM=vZL1kLgNkgpD6fC=J3APHJTN2RKLGySD9-p0JnxcpzQ@mail.gmail.com> |
| References | <CAOuJsM=vZL1kLgNkgpD6fC=J3APHJTN2RKLGySD9-p0JnxcpzQ@mail.gmail.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Tue, 6 Sep 2011 15:47:57 -0600 |
| Subject | Re: import os or import os.path |
| 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.812.1315345714.27778.python-list@python.org> (permalink) |
| Lines | 18 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1315345714 news.xs4all.nl 2447 [2001:888:2000:d::a6]:39762 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:12854 |
Show key headers only | View raw
On Tue, Sep 6, 2011 at 3: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?
"import os.path" is better practice. There is no guarantee in general
that the os module will automatically import os.path, and in future
versions or different implementations it might not.
Cheers,
Ian
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: import os or import os.path Ian Kelly <ian.g.kelly@gmail.com> - 2011-09-06 15:47 -0600
csiph-web