string.Template question

Wells Oliver thewellsoliver at
Mon Apr 5 21:22:29 CEST 2010

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': home_pitcher.attrib['wins'],
'losses': home_pitcher.attrib['losses']
		}, 'win': home_win}

Then, in the template, 'game' is passed, but I want to access like

This doesn't seem to work, though. Is it possible? Or must everything
in the dict passed to string.Template be one-level deep string

More information about the Python-list mailing list