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

Kent Johnson kent at kentsjohnson.com
Tue Apr 18 06:10:31 EDT 2006


Kun wrote:
> Fredrik Lundh wrote:
>> "Kun" wrote:
>>
>>> 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?
>> umm.  if you're using a database, why not filter out uninteresting dates either
>> in the SQL statement, or when you're building the page ?
>>
>>
> because in my sql database, the date is only 'date' (as in yyyy-mm-dd), 
> only when i extract it with my python-cgi does the date turn into 
> (yyyy-mm-dd 00:00:00.00), thus i figured the best way to fix this 
> problem is to parse it after the matter.

It sounds like the problem is with the way you format the date for 
output. Just omit the time.

Kent



More information about the Python-list mailing list