Using the os Module

The os module provides an extremely useful set of functions that allow you to get information from the operating system. For example, when accessing data from a stream that comes from the OS, you can use the os.endianness() function to determine whether the OS is big endian or little endian so that you can use the correct read and write methods.

Table 10.1 lists the methods provided by the os module and describes how you can use them.

Image

Table 10.1 Methods that can be called in the os module

To help you visualize using the os module, the code in Listing 10.1 includes each of the os module calls. Figure 10.1 shows the output. ...

Get Node.js, MongoDB, and AngularJS Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.