Can you use dicts with string.Template?
e.g. a structure like:
game = {
'home': {'team': row['home_team_full'], 'score':
row['home_score'],
'record': '0-0', 'pitcher': {
'id': home_pitcher.attrib['id'], 'name':
home_pitcher.attrib['last_name'], 'wins': hom
In writing out python classes, it seems the 'self' is optional, meaning that
inside a class method, "self.foo = bar" has the same effect as "foo = bar".
Is this right? If so, it seems a little odd- what's the rationale?
Or am I mistaken?
--
Well
h is the
"file.write(handler.read())" line..
What gives?
--
Wells Oliver
we...@submute.net
--
http://mail.python.org/mailman/listinfo/python-list
x27;, 'ER']
Neither alphabetical nor the order in which they were specified in the query
nor... any seeming order I can suss out. Any ideas? Thanks!
(cursor being a MySQLdb.cursors.DictCursor object.)
--
Wells Oliver
we...@submute.net
--
http://mail.python.org/mailman/listinfo/python-list
I can suss out. Any ideas? Thanks!
>>
>> (cursor being a MySQLdb.cursors.DictCursor object.)
>>
>
> My guess is you're experiencing the fact that dicts are unordered by nature
> which allows it to return in any order it likes (usually per the internal
> representation/storage).
>
> -tkc
>
>
>
>
--
Wells Oliver
we...@submute.net
--
http://mail.python.org/mailman/listinfo/python-list
scope such that the
preference shifts from the former to the latter? I understand the use of the
__name__ == 'main' convention for building unit tests, but I'm mixed on
using it in scripts/small applications.
Thanks for any thoughts!
--
Wells Oliver
we...@submute.net
--
http://mail.python.org/mailman/listinfo/python-list
I am trying to find examples using RPY2 to render R graphs to PNG/PDF/etc.
The only things I can find use rpy 1.x. Any references? Thanks!
--
Wells Oliver
we...@submute.net
--
http://mail.python.org/mailman/listinfo/python-list
Bit of code:
print sorted(results.items(), key=operator.itemgetter(1))
Would rather use 'H9', which is the name of the key in position 1 like:
print sorted(results.items(), key=operator.itemgetter('H9'))
Obviously that ain't work else I wouldn't be sending th
on the value being in the same index as its
corresponding key?
--
Wells Oliver
we...@submute.net
--
http://mail.python.org/mailman/listinfo/python-list