[Python Wpg] Wednesday February 22, 7:30 meeting
Stuart Williams
stuartw at mts.net
Tue Feb 21 09:33:36 EST 2006
>>>>> Mark Jenkins writes:
> Subject: [Python Wpg] Wednesday February 22, 7:30 meeting
> * A program to determine when to hold a meeting based on individual
> time preferences. I submitted this to the list in the past when we
> were trying to determine a meeting time. Stewart, I never found out
> if you used this or not.
I did! It was handy.
I made a few changes for data entry.
First I changed this:
{
'day' : 'Tue',
'ofMonth' : (3,4),
'startTime' : '16:00',
'endTime' : '22:00'
},
to this:
dict(day = 'Tue', ofMonth = (3,4), startTime = '16:00', endTime = '22:00'),
Next I changed it to this even more compact easier to type format:
s = """
User Name
Tue 34 16:00 22:00
Wed 34 16:00 22:00
"""
which I parsed thusly:
for line in s.split('\n')[1:-1]: # drop first and last empties
if line.startswith(' '):
day, ofMonth, startTime, endTime = line.split()
ofMonth = tuple( [int(m) for m in tuple(ofMonth)] )
priorities_for_each_person.setdefault(name, []).append(
dict(day = day, ofMonth = ofMonth,
startTime = startTime, endTime = endTime))
else:
name = line.strip()
Stuart.
More information about the Winnipeg
mailing list