Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Task 0 2 : Understanding the sys Module ( 2 0 points ) Write a Python script that uses the sys module to perform the
Task : Understanding the sys Module points
Write a Python script that uses the sys module to perform the following tasks:
In a main method:
a Read and print the commandline arguments when the script is run.
b Print the Python path the directories where Python is looking for modules to
import
c Print the Python version.
d Print the platform name.
The main function must only run automatically if the module is being run directly, not
when imported.
Here is a screenshot of the expected behavior, testing all scenarios described above. Replicate
this functionality in your script, including the formatting and outputs of all messages. The
program must work for any arguments that the user provides after the name of the script.Commandline arguments:
labhtasksdevil.py
system
programming
in
Python
is
a
hoot!
Python path:
homeericlab h
usrlibpythonzip
usrlibpython
usrlibpythonlibdynload
usrlocallibpythondistpackages
usrlibpythondistpackages
Python version: main May ::GCC
Platform name: linux
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started