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

McCarney, James Alexander James.Alexander.McCarney@Cognicase.com
Wed, 9 Oct 2002 16:06:23 -0400


Hi list,

I want to search for all files in a folder/subfolder and output to a
textfile.

OS: Windows 2000
Py Version: 2.2.1

Here are the steps I think my script should take:

Accept the folder name and wildcard file search; if folder doesn't exist
tell me. If there are no files of the type for which I am searching tell me.

Ask me the name of the file to which I want to save the info.

Locate the folder.

Locate the files.

Open files for reading

Report the name and location of the file and put it in front of the returned
info.

Take whatever begins with '<' and ends with '/>'

Open a file for writing.

Put the '<' ... '/>' in the file

Save the file.

###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
"""
Traceback (most recent call last):
  File "<pyshell#16>", line 1, in ?
    folder
NameError: name 'folder' is not defined
"""

I would have thought if I entered (for example) "c:\*.*", when I type >>>
folder I would have gotten the input stored in folder.

Can anyone please tell me where to start? I thank you all for your help.