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

+1 vote
I am new to python scripting. Can anyone tell what is the difference between a module and a script in python?
Apr 19, 2018 in Python by ned_crew
• 1,610 points
An executable piece of code, run by itself is generally referred to as a script.

A module is generally a library, imported by other pieces of code.

7 answers to this question.

+1 vote

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. In case you want to know more about python scripting and learn how to write scripts, you can refer this video: https://youtu.be/9F6zAuYtuFw or you can join Python online course today.

answered Apr 19, 2018 by Johnathon
• 9,090 points
Thq .....
For ........edureka
+2 votes

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

answered Mar 14, 2019 by rajesh kumar
+2 votes
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.

When we talk about "Python Scripts" ,for example script is a string which you manipulate after reading the whole string Similarly a term which is known as " Python Interpreter" which reads all the scripts complies this scripts in a bytescode and executes this bytescode to run the program.
answered Jun 17, 2019 by Zain Abbas
Thanks! That was a clear explanation
So modules are like libraries?
@Zain, that is a nice explanation. But can you also share some code snippet to explain the concept better?
0 votes

python script is bunch of code line that perform the specific action according to user need but Python Modules present a whole group of functions, methods, or data that should relate to a common theme.Such a theme might be networking components ,math components etc for more detail above module check this link

answered Jun 7, 2020 by sahil
• 580 points
0 votes
A script is a .py file that contains multiple Python commands that are usually run sequentially. Scripts are usually used to conduct a specific task, or solve a specific problem. Scripts often use functions and other programming tools that are contained in modules.

A module is also a .py file, and also contains multiple Python commands. However, usually these commands are organized into functions and other organizational bundles like classes, and the commands are not run sequentially. Instead the commands are run in an on-demand basis, where the module user (often a script) specifies which of the module's functions and/or commands should be executed, and at what point(s) in the script.  Modules do not conduct specific tasks or solve specific problems. Instead, their functions and classes are meant to be general-use tools that can be used to solve a variety of problems.

As an example, consider a simple task like downloading the forecasted maximum temperature for today from your favorite weather website. A script for conducting this task would access the website, download the relevant data, then report the result to you, possibly by printing the forecasted maximum temperature to the screen of your computer. The script might also use a variety of modules, including especially a web-access module, which contains functions for accessing websites and downloading relevant data from them. In this case, the module's functions would allow you to access not only your favorite weather website, but any website.

You can therefore think of scripts as a specific-purpose sequence of commands, and modules as a general-purpose set of programming tools.
answered Oct 6, 2020 by 0todd000
0 votes

Python script is a collection of commands in a file designed to be executed like a program. Often a script first contains a set of function definitions and then has the main program that might call the functions. .

answered Dec 16, 2020 by Roshni
• 10,520 points
0 votes

To create a module just save the code you want in a file with the file extension .py :

  1. Save this code in a file named mymodule.py. ...
  2. Import the module named mymodule, and call the greeting function: ...
  3. Save this code in the file mymodule.py. ...
  4. Import the module named mymodule, and access the person1 dictionary:

answered Dec 16, 2020 by Gitika
• 65,910 points

Related Questions In Python

0 votes
4 answers

What is a Tuple in Python and how to use it?

Tuples  are a  Unchanging sequence of values, ...READ MORE

answered Jun 21, 2020 in Python by sahil
• 580 points
0 votes
1 answer

Is there a way to loop between 0 and 1 by 0.1 in python?

You can use the linespace function. It ...READ MORE

answered May 28, 2019 in Python by Olly
0 votes
1 answer

How Do You Run A Python Script In Blender?

Blender is a free and open-source 3D ...READ MORE

answered Jul 30, 2019 in Python by Mohammad
• 3,230 points
0 votes
1 answer

Can you explain what is the use _init_ and self in python?

Hi, The basic difference between these two are _init_ ...READ MORE

answered Aug 14, 2019 in Python by anonymous
0 votes
0 answers

What do the three different types of brackets in Python code mean? I'm not sure if this is right, so if I'm wrong, please tell me:

[] - Normally used for dictionaries, list items () - ...READ MORE

Sep 11, 2023 in Python by Satyawrat
• 460 points
+1 vote
1 answer

What is the difference between range and xrange functions in Python 2.X?

xrange only stores the range params and ...READ MORE

answered Aug 22, 2018 in Python by Priyaj
• 58,090 points
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,138 views
0 votes
1 answer
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP