Printing a "status " line from a python script

Steve Holden steve at holdenweb.com
Tue Nov 11 14:19:57 EST 2008


Chris Seymour wrote:
> Hi All,
> 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.
> 
> I am not sure if this is even possible.  Any thoughts would be greatly
> appreciated.
> 
Try printing each filename with

  sys.write("\r%s\r%s" % (" "*80, filename)

It's crappy, but it might just work (you may need to change the 80 to
some other numeric value).

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list