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 express the
result of datetime.datetime.now() in fractional hours.
Here's one way.
dt=datetime.datetime.now()
xtup = dt.timetuple()
h = xtup[3]+xtup[4]/60.0+xtup[5]/3600.00+xtup[6]/10**6
# ?now is in fractions of an hour
From Dave Mon Jan 11 05:16:03 2010
From: Dave (Dave)
Date: Sun, 10 Jan 2010 22:16:03 -0600
Subject: interactive terminal in Ubuntu Linux : libreadline5-dev works
only in Python 2.6 not 3.1
References: <
[email protected]>
<23c7
[email protected]>
<
[email protected]>
<15a78
[email protected]>
Message-ID: <
[email protected]>
On Sat, 9 Jan 2010 16:48:52 -0800 (PST), casevh wrote:On Jan 9, 3:10?pm, pdlem... at earthlink.net wrote:
On Sat, 9 Jan 2010 13:27:07 -0800 (PST), casevh <cas... at gmail.com>
wrote:
1) Try the commands again. Make sure all the "./configure" options are
on one line. Make sure to do "sudo make altinstall". (Don't use "sudo
make install"; it will give your version of Python the name "python"
and that can cause confusion on your system.)
2) Move your applications to another directory.
3) Try running "python3.1" while you are in that directory.
If this doesn't work, report back on the error messages you receive.
Thanks casevh for your time & patience.
The ./configure . . . was a "continuous" line , although it ran over to
next line even on 132 char wide terminal because of names of system &
dir. I was careful with the spaces and hyphens.
In my reply the "make install" was a typo , I did run make altinstall.
Moved all my code to pycode dir on my home directory. Removed all
files from /usr/local/lib/python3.1/dlmodules and removed that dir.
Twice ran the recompile :
make distclean
./configure --prefix=/usr/local --with-computed-gotos
--with-wide-unicode
<^ one space>
make
sudo make altinstall
After each reinstall had same problems : cannot import random or
any code using it, although random.py is in Lib :
Traceback
File "<stdin>", line 1, in <module>
File "random.py", line 46, in <module>
import collections as _collections
File "collections.py", line 9 in <module>
from _collections import deque, default dict
ImportError: /usr/local/lib/python3.1/lib-dynload/collections.so:
undefined symbol: PyUnicodeUCS4_FromString
After second reinstall today I also found that a module importing
"time" would not run. Likewise could not import time at >>> .
Same error, ending : undefined symbol: PyUnicode UCS4_FromString
And my original problem still there : fouled up keys in interactive
terminal. Seems minor now ; ) Should I try to remove everything
and reopen the tarball ?
Dave WB3DWE, central Texas