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


Groups > comp.lang.python > #80946

Re: import os

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'importing': 0.05; 'string': 0.09; 'windows,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'assume': 0.14; 'available;': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'less,': 0.16; 'os.curdir': 0.16; 'semicolon': 0.16; 'separator,': 0.16; 'subject:import': 0.16; 'variable.': 0.16; 'wrote:': 0.18; 'module': 0.19; 'dependent': 0.19; 'else,': 0.19; 'meant': 0.20; 'cc:addr:python.org': 0.22; 'entries': 0.24; 'instance,': 0.24; 'mon,': 0.24; 'environment': 0.24; 'cc:2**0': 0.24; 'header:In- Reply-To:1': 0.27; 'character': 0.29; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'reply.': 0.31; 'directory,': 0.31; 'stuff': 0.32; 'linux': 0.33; "can't": 0.35; 'something': 0.35; 'more,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'representing': 0.36; "didn't": 0.36; 'thanks': 0.36; 'operating': 0.37; 'nov': 0.38; 'pm,': 0.38; 'does': 0.39; 'break': 0.61; "you're": 0.61; 'kind': 0.63; 'box,': 0.64; 'fact,': 0.69; 'differently:': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=fI59h+5BGVuELdiqPIrv7+2xWEcMa+y/8y28UIEWO+Y=; b=QiIg8PlOFCmkPcv1gRw3U15S/lmxVCZVPzbca437y0SCoMHUePZqam0o5A/a3gl6VH vNRgwiFwJ6Ep1Z5/gD8ngLA2sAOYdR2p5SYRye1Caj82HLR+zUQGvmW2UDhfMnRQ+7YM nb7FRGtvLBQ/wS6qGoLobt+LZsdet1a8Kygzp3b+T0Wl2lpi+z2UVy4Nt2/fo1v18oNL pFSTHjkivC5DE3Mt5BP27opDvdCr6XakDSsmXCtvju8L+7doB/XXeP7eCpLS/7hR0Eok M9l7J/1zbJvhNTOLCLwBtgUK4xpwNg0hxfcIlL2J2u8MX7imCWrFohesTcliMiRmGk7v bd6A==
MIME-Version 1.0
X-Received by 10.50.178.212 with SMTP id da20mr17649209igc.34.1416188090771; Sun, 16 Nov 2014 17:34:50 -0800 (PST)
In-Reply-To <CAA+hu4Ve2iy7YwL2yFYW4eZY7U5sHrNZfoFWccJ_HxaAgcY86Q@mail.gmail.com>
References <CAA+hu4U97wO7G00Kdc917XJqJadGCVQEuLJgrO8SPH-NEvjpxQ@mail.gmail.com> <CAPTjJmrit1=EyBbD9tisf=vphmfxOFq8AFkXx7_Fqivqo4a2=g@mail.gmail.com> <CAA+hu4Ve2iy7YwL2yFYW4eZY7U5sHrNZfoFWccJ_HxaAgcY86Q@mail.gmail.com>
Date Mon, 17 Nov 2014 12:34:50 +1100
Subject Re: import os
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.15935.1416188099.18130.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416188099 news.xs4all.nl 2934 [2001:888:2000:d::a6]:43638
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:80946

Show key headers only | View raw


On Mon, Nov 17, 2014 at 12:10 PM, Abdul Abdul <abdul.sw84@gmail.com> wrote:
> Thanks for your reply. Yes, I came across this page, but didn't understand
> what is meant by the operating system dependent functionality. What does
> that mean? Is importing that module that serious?

It's not "serious" as in "using this module can break your code". What
it means is that stuff in the os module might not always be available;
on my Linux box, len(dir(os)) is 326, but on my Windows, it's only
145. (Similar Python versions.) A lot of the os module is available on
every platform you're ever likely to use, but need to be named
differently: for instance, os.curdir is the string representing the
current directory, and os.pathsep is the character that divides
entries in the PATH environment variable. You can assume that there
*will be* some kind of path separator, but you can't know whether
it'll be a semicolon (Windows), a colon (Unix), or something else, so
you call up the os module to find out. In fact, proper use of the os
module can make your code more, not less, cross-platform.

ChrisA

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


Thread

Re: import os Chris Angelico <rosuav@gmail.com> - 2014-11-17 12:34 +1100

csiph-web