import os

Dan Stromberg drsalists at
Mon Nov 17 02:15:33 CET 2014

On Sun, Nov 16, 2014 at 5:10 PM, Abdul Abdul <abdul.sw84 at> 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, it's better to use "with open as
file_",, 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.

More information about the Python-list mailing list