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
inputWithinRange (prompt, lowValue, highValue) This function will ask for a number using the prompt parameter. The function will only return a value that is within the inclusive ra

Procedure calls When you compute an expression of the form ( ,  ..., )   the Python interpreter treats  this as a procedure call. It will be simpler to talk about

What are squared matrices?

Expressions and assignment We can think of most computer programs as performing some sort of transformation on data.  Our code may get as input the exam scores of everyone in

Python  Style Software  engineering courses  often  provide very  rigid  guidelines on the style of programming, generally the appropriate value of indentation, or what  to us

Structured assignment Once  we have  tuples and lists, we may use  a nice trick  in assignment expression, based  on the packing and unpacking of tuples. >>> a, b, c = 1, 2

In English, specify a representation of the board game in Python. The representation should capture the entire state of the game at one point in time. It may be helpful to first fi

Primitives, Composition, Abstraction, and Patterns   We will  start  by thinking about  how  the  PCAP  framework applies to computer programs, in general. We may do that by

Procedures as First-class objects In Python, unlike  many  other  languages, methods are behave in much  the same way as num­ bers:  they  can be stored as values  of variable

#que Write a program that will take price data for stocks and print it graphically to the screen. Your program should begin by asking the user for the file name. It should then cre