0% found this document useful (0 votes)
3 views1 page

Ython

modules

Uploaded by

Agatha Rivera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Ython

modules

Uploaded by

Agatha Rivera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Navigating

Python Modules

Python modules summarize definitions and statements


that make your code more concise. You can reuse
these units over and over again to make your code
only show what is necessary.

io
This module handles input/output
operations and works by treating all
objects like file-like objects.

os
This module is beneficial for working with
the operating system. Some functions can
create directories, delete files, and more.

os.path
Similar to the os module, this is beneficial
for working with files “in a platform-
independent manner” or in directory paths.

sys
This module is for interpreter-specific
information or codes and for system
operations.

difference
These modules handle information differently. For
example, sys is for the Python interpreter. On the other
hand, io treats information like files.

Math datetime random


This module can do This is like a calendar. You This module can generate
arithmetic operations like can work with different random possibilities in
addition, subtraction, dates and times and general. For example, you
trigonometry, logarithms, represent them based on can generate different
and more. different names. sequences.

Real-life application
The math module is helpful when dealing with numeric values. For example, you
are calculating costs in the grocery store. The datetime module is useful for
getting different information about the current date, timezone, and more. This
can solve complex time-related problems. Random modules are helpful for
having random generations and outputs. For example, there is a wheel of
fortune game on a website. The random.choice() can aid in making the game
random.

You might also like