Category: Python3

Added: 1st of December 2020

Viewed: 1,642 times

Learning Python3, System calls on Linux

To make a system call from your Python script, for example displaying the current version of Python3 using the command python3 --version, we need to use the import os module, and use the os.system function

Create a new file named and copy and paste the code below


import os
os.system('python3 --version')

Then enter the following command to make the Python script executable
chmod +x

Then run the script by the entering the command

If everything works correctly the current version of Python3 will be display in the terminal