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

2006-04-18 Thread Kent Johnson
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 de

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

2006-04-18 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > >Kun> assuming that my date column is 2, how would i parse out the date? > > No parsing required. Just get its date: > >d = record[2].date() > > The str() of a datetime.date object is a string in -MM-DD form. or, in other words, change: for col in range

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

2006-04-17 Thread skip
Kun> assuming that my date column is 2, how would i parse out the date? No parsing required. Just get its date: d = record[2].date() The str() of a datetime.date object is a string in -MM-DD form. Kun> the example you gave is of you parsing out the current time, but Kun> h

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

2006-04-17 Thread Kun
Tim Chase wrote: >> for col in range(0, numcols): >> print "", record[col], "" > > This is the point at which you want to intercept the column data and > make your change: > > print "", str(record[col]).replace("00:00:00.0", ""), " > If it's possible/plausible that other fie

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

2006-04-17 Thread Kun
[EMAIL PROTECTED] wrote: > Kun> i have the following python-cgi which extracts data from a mysql > Kun> table, how do i parse the date so that it doesn't display the time > Kun> '00:00:00.00'? > > I have no idea which column in your table is a datetime object, but just > convert it to

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

2006-04-17 Thread Tim Chase
> for col in range(0, numcols): > print "", record[col], "" This is the point at which you want to intercept the column data and make your change: print "", str(record[col]).replace("00:00:00.0", ""), "%s" % foo or alternatively DATECOLUMNS = [3, 14] for col

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

2006-04-17 Thread skip
Kun> i have the following python-cgi which extracts data from a mysql Kun> table, how do i parse the date so that it doesn't display the time Kun> '00:00:00.00'? I have no idea which column in your table is a datetime object, but just convert it to a date. For example: >>> impor

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

2006-04-17 Thread Kun
Fredrik Lundh wrote: > "Kun" wrote: > >> because in my sql database, the date is only 'date' (as in -mm-dd), >> only when i extract it with my python-cgi does the date turn into >> (-mm-dd 00:00:00.00), thus i figured the best way to fix this >> problem is to parse it after the matter. >

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

2006-04-17 Thread Fredrik Lundh
"Kun" wrote: > because in my sql database, the date is only 'date' (as in -mm-dd), > only when i extract it with my python-cgi does the date turn into > (-mm-dd 00:00:00.00), thus i figured the best way to fix this > problem is to parse it after the matter. you still make no sense. why n

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

2006-04-17 Thread Kun
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 >> instanc

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

2006-04-17 Thread Fredrik Lundh
"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 us

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

2006-04-17 Thread Larry Bates
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

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

2006-04-17 Thread Tim Chase
> 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 e

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

2006-04-17 Thread Kun
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?