
June 5th, 2004, 01:01 AM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
I dont see any reason why this shouldnt work. The only problem i can see would be a KeyError if the element didn't exist within the dictionary. Does the dictionary contain strings or digits. In any case give this a go:
Code:
elements = {'one': 'two', 'three': 'four'}
def function(element):
print element
function(elements['one'])
This should simply show the element in the console. Maybe you can show us your whole program since i can't see any reason to do 'var = "%s" % element'; if you do want to convert the element to a string and it isnt already then use the str() function instead  i.e.
Hope this helps,
Mark.
__________________
programming language development: www.netytan.com – Hula
|