What do you mean by python scripting What is a script and a module in python

844    Asked by MariaHodges in Python , Asked on Jul 27, 2021

I am new to python scripting. Can anyone tell what is the difference between a module and a script in python? what is python scripting?

Python scripting:

A scripting language is a programming language that uses an Interpreter to translate its source code. The interpreter reads and executes each line of code one at a time, just like a SCRIPT for a play or an audition, hence the the term "scripting language".

Python uses an interpreter to translate and run its code and that's why it's called a scripting language

A Python script normally can be full of functions that can be imported as a library of functions in other scripts, or a python script can be a command that runs in Rhino.

There is a way to have Python definitions be both a library of functions and a direct command.

The key is to add these statements to the end of the file:

      if __name__ == '__main__':

    CreateCircle() # Put the a call to the main function in the file

A script is used to automate certain tasks in a program. It can run by itself and it is less code intensive whereas modules in python is referred as a library which can not run by its own. It needs to get imported in order to use it.

Module in python:

A module is a file containing a set of functions. For example different datatypes functions are included Suppose this module is just a kind of library. When we talk about C++ library" # include< iostream>" then it means all the algebraic functions are present in this library.



Your Answer

Interviews

Parent Categories