scanning through page and replacing all instances of 00:00:00.00

Tim Chase python.list at tim.thechases.com
Mon Apr 17 17:32:50 EDT 2006


> I have a python-cgi file that pulls data from an sql
> database, i am wondering what is the easiest way to
> remove all instances of '00:00:00.00' in my date column.
> 
> how would i write a python script to scan the entire page
> and delete all instances of '00:00:00.00', would i use
> regular expressions?

No need for a regexp:

someString = someString.replace("00:00:00.00", "")

I'd recommend doing it before you print the values out, 
rather than try and "scan the entire page" after you've 
printed them.

Easy 'nuff.

-tkc








More information about the Python-list mailing list