Modules, Python Programming

Modules

As you start to write larger programs, you will want  to save the function de?nitions in multiple ?les, collected together according to what  they  do.  So, for example, we may  collect a set of utility  functions together into  in one file, called  utility.py.  This ?le is known as  a module in Python.

 

Now,  if we want  to use  those  procedures in another shell or file,  we will require to say import utility so that  all those  procedures become  available to us and  to the Python interpereter.  Now,  if we have a function in utility.py named foo, we may use it with the name  utility.foo. You may study  more  about  modules, and  how  to instance reference functions described in procedures, in the Python documentation.

 

Posted Date: 8/9/2012 6:59:31 AM | Location : United States







Related Discussions:- Modules, Assignment Help, Ask Question on Modules, Get Answer, Expert's Help, Modules Discussions

Write discussion on Modules
Your posts are moderated
Related Questions
Print vs Return Here are two different method declarations: def f1(x): print x + 1 def f2(x): return x + 1 What happens when  we call them? >>> f1(3) 4 >>

We encourage you to adopt an interactive style of debugging and programming. Use the Python shell a lot. Write short pieces of code and check them.  It is much  simpler to test the

Your assignment for the semester will involve the development of a system for drawing trees using the Python programming language and the turtle graphics module (turtle.py). Comple

Non-local references in procedures There  is an important subtlety in the  way  names  are handled in the  environment created by a function call. When  a value  that  is not

how do you make an if and else statment work in pytho?

Bank transfer What  if we  have  two  values,  representing bank  accounts, and  need  to transfer an  amount of money  amt between them?  Consider that a bank account is show

Internal models As we want to create  more and more complex  machine with  software programs as controllers, we search  that  it is often needful  to create  additional types

#question.Program 10 Assignment (Banking Objects – Savings/Checking Accounts) Create a program named 10.py that performs the following: Create a class named ChkAcct, and a class n

how to make a python programme for van der waals equation of state with surface discontinouty