>>> l = []
>>> s = 'a|b'
>>> t, l = s.split('|')
>>> t
'a'
>>> l
'b'
>>> s = 'a|b|c|d'
>>> t, l = s.split('|')
Traceback (most recent call last):
File "", line 1, in ?
ValueError: too many values to unpack
>>>
so, i imagine what is happening is the lhs, t,l, is really
(t, (l)), i.e. only two it
> I'm very sorry to say, that the Python doc is one of the worst possible
> in the industry.
you are entitled to a full refund
--
http://mail.python.org/mailman/listinfo/python-list
> I am wondering why I am getting this error. when I try to run a script.
> TypeError: translate() takes at most 3 arguments (10 given)
> but the thing is the method translate actually accepts 10 arguements.
without code, how is anyone to know?
--
http://mail.python.org/mailman/listinfo/python
> So I'm going to try to pump you for a little more information here. Is
> your goal to count, for each week, how many times it's "full" and how
> many times it's "not full"? What do you use the counts for? What does
> "full" mean? Is it always a 0 or 1? What's the importance of the
> outp
> bin = {}
> for start, end, AS, full in heard:
>week = int((start-startDate)/aWeek)
>counters = bin.setdefault(week, [0, 0])
>if full:
> counters[0] += 1
>else:
> counters[1] += 1
yes! thanks!
> Using an idea you used earlier, you coul
>> bin = {}
>> for whatever:
>>for [a, b] in foo:
>>x = 42 - a
>>if bin.has_key(x):
>> bin[x.b] += 1
>>else:
>> bin[x.b] = 1
>> bin[x.not b] = 0
>> for x, y, z in bin.iteritems():
>>print x, y, z
>>
>> should the dic
i have some code which looks kinda like
bin = {}
for whatever:
for [a, b] in foo:
x = 42 - a
y = 42 - b
if bin.has_key(x):
bin[x] += 1
else:
bin[x] = 1
for i, j in bin.iteritems():
print i, j
now i want t
>>hold = self.next
>>self.next = DaClass(value)
>>self.next.next = hold
>>
>> but i suspect (from print statement insertions) that the result
>> is not as i expect. as the concept and code should be very
>> common, as i am too old for pride, i thought i would ask.
> I think you're fine
> There is also a python tutor newsgroup at gmane
> (gmane.comp.python.tutor).
is there a mailing list to which it is gated?
randy
--
http://mail.python.org/mailman/listinfo/python-list
i am doing disgusting looking junk based on calendar. example
now = calendar.timegm(time.gmtime())
aWeek = 7*24*60*60
print time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(now + aWeek))
randy
--
http://mail.python.org/mailman/listinfo/python-list
i left the usenet in the latter half of the '80s. a few weeks
ago i decided i wanted to do a new project with a new language,
and chose python. so i joined this mailing list, which is
gated to the usenet. i am impressed that the s:n has not
gotten significantly worse than when i left, about 0.25
>> hold = self.next
>> self.next = DaClass(value)
>> self.next.next = hold
> shouldn't that last line be this?
> self.next.prev = hold
single threaded list
> What did you expect, and what did you ovserve?
i will try to distill a case
randy
--
http://mail.python.org/mailman/l
i am trying to insert into a singly linked list
hold = self.next
self.next = DaClass(value)
self.next.next = hold
but i suspect (from print statement insertions) that the result
is not as i expect. as the concept and code should be very
common, as i am too old for pride, i thought i
computers are cheap. i am expensive. give me clear and maintainable
code every time.
randy
--
http://mail.python.org/mailman/listinfo/python-list
> Firstly, to remove one possible source of confusion, change the name of
> your dictionary ... "mydict" or "fred" ... anything but "dict"
>
> Next, after you have created the dictionary and added items to it, do this:
> print len(fred)
> print len(fred.items())
> nitems = 0
> for k, v in fred.it
>> a dict written as
>>
>>pKey = (prefix, pLen, origin)
>>
>>val = dict.get(pKey)
>>if val == None:
>> dict[pKey] = (timeB, timeB)
>>else:
>> if val[0]> timeB: val[0] = timeB
>> if val[1] < timeB: val[1] = timeB
>> dict[pKey] = val
>>
>> and read back as
a dict written as
pKey = (prefix, pLen, origin)
val = dict.get(pKey)
if val == None:
dict[pKey] = (timeB, timeB)
else:
if val[0] > timeB: val[0] = timeB
if val[1] < timeB: val[1] = timeB
dict[pKey] = val
and read back as
for pKey, pVal in dict.iteritems(
17 matches
Mail list logo