Chris Seymour wrote:
I am working on a python script for my colleague that will walk a directory and search in the different files for a specific string. These pieces I am able to do. What my colleague wants is that when she runs the script the filename is replaced by the current file that is being processed. So instead of seeing a series of files being listed down the page, she only wants to see the file currently being processed.
You should know that printing "\b" issues a backspace. You can couple this with printing without line endings using a trailing comma:
print "Now processing file", # Trailing comma = no line ending previous = "" names = ["one", "two", "three"] for name in names: if previous: print "\b" * (len(previous) + 2), # Trailing comma again print name, # Yet another trailing comma previous = name # Do whatever other processing you need here print # At last a line ending Hope this helps. - Alex -- http://mail.python.org/mailman/listinfo/python-list