IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 1 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Oh, and a couple of Python questions
There is some assumptions about the iteration through the dictionaries that I don't know if it holds. The only one that it's important to maintain the sequence is the order of the page(s) in the pages dictionary. I'm assuming that the hash will spit out the keys in numeric order. Is there a way to force the dictionary for loop to have it sorted by key?

Also, the date/time stamp uses a constant of -05'00' as the offset from UTC - meaning -5 hours which is CST. Couldn't find a Python function to calculate offset from UTC. Know of one offhand?
New Atempts at replies
> There is some assumptions about the iteration
> through the dictionaries that I don't know if
> it holds. The only one that it's important to
> maintain the sequence is the order of the page(s)
> in the pages dictionary. I'm assuming that the
> hash will spit out the keys in numeric order.

This is the major reason I switched some of the dictionaries to lists of 2-tuples--order is automatic. If I took another pass, I'd probably make a tiny class. But I admit I'm assuming that you'll never skip section numbers.

> Is there a way to force the dictionary for loop
> to have it sorted by key?

Sure.

>>> a = {0: 'a', 1: 'b', 2: 'c', 3: 'd'}
>>> keys = a.keys()
>>> keys.sort()
>>> for key in keys:
... \tprint a[key]
... \t
a
b
c
d

> Also, the date/time stamp uses a constant of -05'00'
> as the offset from UTC - meaning -5 hours which is CST.
> Couldn't find a Python function to calculate offset
> from UTC. Know of one offhand?

If you simply want the current UTC time, use datetime.datetime.utcnow() instead of .now() -- you really should use datetime instead of the time module, as it allows a wider range of dates (the time module = time since the (system-dependent) epoch).
I was one of the original authors of VB, and *I* wouldn't use VB for a text
processing program. :-)
Michael Geary, on comp.lang.python
     Generating PDF - (ChrisR) - (7)
         Very nice. - (FuManChu) - (4)
             Here 'tis. - (FuManChu) - (3)
                 Couple of tweaks here and there - (ChrisR) - (2)
                     Oh, and a couple of Python questions - (ChrisR) - (1)
                         Atempts at replies - (FuManChu)
         Don't know if this was mentioned in the other thread, but - (altmann) - (1)
             Definitely the way to go for Pythonistas - (ChrisR)

Note for the linguistically-impaired: That was a rhetorical question. (Second note, for the vocabulary-challenged: That means you're not supposed to answer it.)
54 ms