[Tutor] pseudo code --- search for <> tags

alan.gauld@bt.com alan.gauld@bt.com
Thu, 10 Oct 2002 14:13:24 +0100


> ###pseudo code start
> def TagFinger():
>     """Finds mark-up, and prints it to a text file."""
>     #imports
>     import sys, string, os, os.path
>     #welcome
>     print "Welcome to TagFinger!"
>     print ""
>     folder=raw_input("Please type the name of the folder you 
> wish to search:
> ") #this does not work ... Here is the error

folder is defined as a local variable inside your function.

To access it outside the function you need to returnm it:

      return folder

then you can use it thusly:

>>> folder = TagFinger()
gfgfhvghjg
>>> folder
'gfgfhvghjg'

For more on namespaces and scope seee my tutor 
topic 'Whats in a name?'

HTH,

Alan g.
Author of the 'Learning to Program' web site
http://www.freenetpages.co.uk/hp/alan.gauld