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


Groups > comp.lang.python > #80941 > unrolled thread

Re: import os

Started byDan Stromberg <drsalists@gmail.com>
First post2014-11-16 17:15 -0800
Last post2014-11-16 17:15 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#80941 — Re: import os

FromDan Stromberg <drsalists@gmail.com>
Date2014-11-16 17:15 -0800
SubjectRe: import os
Message-ID<mailman.15930.1416186941.18130.python-list@python.org>
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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web