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


Groups > comp.lang.python > #80941

Re: import os

References <CAA+hu4U97wO7G00Kdc917XJqJadGCVQEuLJgrO8SPH-NEvjpxQ@mail.gmail.com> <CAPTjJmrit1=EyBbD9tisf=vphmfxOFq8AFkXx7_Fqivqo4a2=g@mail.gmail.com> <CAA+hu4Ve2iy7YwL2yFYW4eZY7U5sHrNZfoFWccJ_HxaAgcY86Q@mail.gmail.com>
Date 2014-11-16 17:15 -0800
Subject Re: import os
From Dan Stromberg <drsalists@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.15930.1416186941.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, Nov 16, 2014 at 5: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?

The os module has mostly lower level OS interfaces;  there are
sometimes higher level equivalents elsewhere in the language.

It's not bad to use os, but for EG, file operations
os.open/os.read/os.write/os.close, it's better to use "with open as
file_", file_.read, file_.write.

Another example is os.fork() - you can use it, but you're probably
better off with the subprocess module or the multiprocessing module.

You don't really have to worry about breaking anything by using the os
module - at least, not particularly more than the higher level
interfaces for the same thing.

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


Thread

Re: import os Dan Stromberg <drsalists@gmail.com> - 2014-11-16 17:15 -0800

csiph-web