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 C programming one declares the function ahead of time and define it later (commonly called [link url=http://cplus.about.com/od/glossar1/g/functionpdefn.htm] 'prototyping' [/link] ), 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.

  1. This is NOT the Beginning
  2. Python Best Practice: the Bang Line
  3. The Tasks This Python Program Must Do
  4. Holding the User Data in Python With CGI
  5. Holding the User Data in Python With PHP
  6. Defining the First Python Function
  7. Reading the RSS Feed as a Python File Object
  8. Using a Python Iterator
  9. Calling Python's Function, Retrieving the Feed Address

<< Previous | Next

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.