1. Home
  2. Computing & Technology
  3. Python

Part 2: Getting Feed Information From the Data File With Python

From , former About.com Guide

9 of 9

Calling Python's Function, Retrieving the Feed Address

Now that we have the function defined, we can call it. If you try to use a function before it is defined, Python will throw a NameError. While in C programming one declares the function ahead of time and define it later (commonly called 'prototyping'), Python requires all functions to be defined before they are called.

In order to access the value which is returned by the function, we must store it in a variable. Let's call it feedinfo. The way we assign the output to feedinfo is to call the function as the assignment value.

feedinfo = getlistinfo("dat")

When we implement another data list, we can call the same function, assigning it to a different variable and changing the argument accordingly.

In the next tutorial, we will develop the class for the feed.



Other tutorials in this series:

Part 1 | 2 | 3 | 4
Get the Code!
Explore Python
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Python

©2009 About.com, a part of The New York Times Company.

All rights reserved.