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 18, 2018 in Python by ned_crew
• 1,620 points
3,473 views

3 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

answered Apr 18, 2018 by Johnathon
• 9,070 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 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 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?

Related Questions In Python

0 votes
2 answers

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

  Tuple is a collection of Python objects.it is ...READ MORE

answered Apr 12 in Python by rajesh
• 1,210 points
91 views
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 27 in Python by Olly
27 views
+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
• 56,160 points
132 views
+2 votes
1 answer

How do you make a block comment in python?

''' This is a multiline comment. I ...READ MORE

answered Aug 23, 2018 in Python by Priyaj
• 56,160 points
43 views
0 votes
1 answer

What is the meaning of “int(a[::-1])” in Python?

Assumming a is a string. The Slice ...READ MORE

answered Aug 27, 2018 in Python by Priyaj
• 56,160 points
61 views
0 votes
1 answer

Is there a foreach function in python and is there a way to implement it if there isnt any

Every occurence of "foreach" I've seen (PHP, ...READ MORE

answered Aug 31, 2018 in Python by charlie_brown
• 7,710 points
64 views
+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 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 124 views