Lecture Note
University
American Baptist CollegeCourse
CSCI 1534 | Data Analysis and VisualizationPages
1
Academic year
2023
Muthia Marhamah
Views
0
p {margin: 0; padding: 0;} .ft00{font-size:18px;font-family:NimbusRomanRegular;color:#000000;} .ft01{font-size:18px;font-family:NimbusRomanBold;color:#000000;} Operation Using Modules and Tools OS and OS.Path Module Os is module provide a portable way of using operating system dependent functionality. If you just want to read or write a file or want to manipulate path. The example of os module: 1. Os.name The name of the operating system dependent module imported 2. Os.ctermid Return the filename corresponding to the controlling terminal process 3. Os.path.airname Os.path is module implements some useful function on pathnames. The example of os.path module: a. Os.path.dirname Return the directory name of pathname path. Random Module This module provides function and variables used to manipulate different parts of the python runtime environment. Random module is an in-built module of python which is used to generate random numbers. These are pseudo-random numbers means these are no truly random. This module can be used to perform random actions such as generating random numbers, print random a value for a list or string etc. Random modules example in Python as follows: 1. Seed() to intialize the number generator. 2. Getstate() to returns the current initial state of the random number generator. 3. Setstate() to restore the internal state of the random number generator.
OS and OS.Path Module and Random Module
Please or to post comments