1. Home
  2. Computing & Technology
  3. Python

Part 3: Creating a Feed Class and Finishing the Python Program

From Al Lukaszewski, for About.com

8 of 8

Defining and Calling the main() Thing

Now we can define main(). Because of the high level of abstraction involved in this program, main() is quite small. The code is as follows:

def main():
     output = formBody(feedname)
     print output
That is it for now. We define output in terms of the function formBody and then print the results. We could simply pass the function call to print, but I have kept them separate for simplicity's sake.

Finally, the program is not finished until we call the main() function. To do this, we use the following code:
if __name__ == "__main__":
     main()

Now, you can point your browser to this file on your web server and enjoy your own, personalised and Python-powered RSS Reader. As you do, keep in mind that all is not over for this project. In the future, we will be adding error checking, Unicode handling, and a few other essentials as well as features like images and computerised feed addition. So stay tuned.



Other tutorials in this series:

Part 1 | 2 | 3 | 4 | 5
Get the Code!

Explore Python
About.com Special Features

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

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Python

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

All rights reserved.