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

Kun neurogasm at gmail.com
Mon Apr 17 17:48:23 EDT 2006


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 ?
> 
> </F>
> 
> 
> 
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.

side note: the 'date' column is not formatted as datetime in the mysql 
database.



More information about the Python-list mailing list