Re: Fractional Hours from datetime?

2010-01-10 Thread Austyn
How about: import time arizona_utc_offset = -7.00 h = (time.time() / 3600 + arizona_utc_offset) % 24 dt.timetuple()[6] is the day of the week; struct tm_time doesn't include a sub-second field. On Jan 10, 10:28 am, "W. eWatson" wrote: > Maybe there's a more elegant way to do this. I want to exp

Re: Fractional Hours from datetime?

2010-01-10 Thread Austyn
Here's an improvement in case you want your code to work outside of Arizona: from time import time, timezone h = ((time() - timezone) / 3600) % 24 On Jan 10, 9:04 pm, Austyn wrote: > How about: > > import time > arizona_utc_offset = -7.00 > h = (time.time() / 3600 + ariz

Re: SQL Query via python

2005-05-23 Thread Austyn Bontrager
How about: cursor.execute(""" SELECT name, month, day ,category, city FROM bday WHERE %(col_name)s = %%s """ % dict(col_name=arg1), (arg2) ) The "%(col_name)s" will be replaced by normal Python string substitution, while the "%%s" will be quoted by the db