On 02/24/2011 04:34 AM, rahul mishra wrote:
> try this
>
> test = time.time(2011, 2, 1, 2, 4, 10)
> # this is your datetime object from mysql
>
> print time.mktime(test.timetuple())
>
> hope this would help you
>
>
You do realize that email was sent over four months ago, correct?
See:
>> On
try this
test = time.time(2011, 2, 1, 2, 4, 10)
# this is your datetime object from mysql
print time.mktime(test.timetuple())
hope this would help you
> On Wednesday, August 04, 2010 7:40 PM ? wrote:
> Okey, i have many hours now struggling to convert a mysql datetime
> field that i retr
On 08/07/10 01:45, Νικόλαος Κούρας wrote:
# variant B
for row in dataset:
host, hits, dt = row
# rest of your code here
So, row is a tuple comprising of 3 fields, and host, hist, dt
are variables assigned each one of row's tuple values by
breaking it to it's elements.
But what
Στις 6/8/2010 2:46 πμ, ο/η Tim Chase έγραψε:
# variant B
for row in dataset:
host, hits, dt = row
# rest of your code here
So, row is a tuple comprising of 3 fields,
and host, hist, dt are variables assigned each one of row's tuple values
by breaking it to it's elements.
But what
On 6 Αύγ, 08:13, John Nagle wrote:
> On 8/4/2010 4:40 PM, Íßêïò wrote:
>
> > cursor.execute( ''' SELECT host, hits, date FROM visitors WHERE
> > page
> > = '%s' ORDER BY date DESC ''' % (page) )
>
> Don't do string substitution ("%") on SQL statements. Let MySQLdb do it
> for you, wit
On 8/4/2010 4:40 PM, Νίκος wrote:
cursor.execute( ''' SELECT host, hits, date FROM visitors WHERE
page
= '%s' ORDER BY date DESC ''' % (page) )
Don't do string substitution ("%") on SQL statements. Let MySQLdb do it
for you, with proper escaping:
cursor.execute('''SELEC
On 08/05/10 16:01, Νίκος wrote:
On 5 Αύγ, 22:09, Tim Chase wrote:
dataset = cursor.fetchall()
for row in dataset:
print ( '''''' )
So, 'dataset' in here is a 'list of tuples' right? and 'row'
in here is a tuple form the above list of tuples right?
Am i understanding this correct
>On 5 Αύγ, 22:09, Tim Chase wrote:
> On 08/05/10 13:52, Νίκος wrote:
>
> > dataset = cursor.fetchall()
>
> > for row in dataset:
> > print ( ''' ''' )
As i have it the returned 'dataset' is stored line per line to 'row'.
So,
'dataset' in here is a 'list of tuples' right?
and
'row' in here
On 08/05/10 13:52, Νίκος wrote:
dataset = cursor.fetchall()
for row in dataset:
print ( ''' ''' )
date = row[2].strftime( '%d %b, %H:%M' )
print ( ''' %s %s %s ''' %
( row[0], row[1], date ) )
Unfortunately had to ditch the 'for entry in row' line because
cou
Hey i made it! :-)
dataset = cursor.fetchall()
for row in dataset:
print ( ''' ''' )
date = row[2].strftime( '%d %b, %H:%M' )
print ( ''' %s %s %s ''' %
( row[0], row[1], date ) )
Unfortunately had to ditch the 'for entry in row' line because
couldn't iterate over the it
On 5 Αύγ, 11:55, Dennis Lee Bieber wrote:
> On Wed, 4 Aug 2010 16:40:45 -0700 (PDT), Íßêïò
> declaimed the following in
> gmane.comp.python.general:
>
> > for entry in row:
> > entry = datetime.datetime.strftime( entry, '%d
> > %b, %H:%M' ) #!!!
> >
Okey, i have many hours now struggling to convert a mysql datetime
field that i retreive to a string of this format '%d %b, %H:%M'
I google a lot but couldnt found out how to format it being a string
Here si the code so far:
try:
cursor.execute( ''' SELECT host, hits, dat
12 matches
Mail list logo