element = {'h': 1, 'he': 2, 'li':3, 'be':4, 'b':5}
print 'Atoms.py loaded and ready'
data = [ [0 , 0, '0'] , [1, 1.008, '1s1'] , [2, 4.003, '1s2'] ]
def lookup ( name ) :
element[name]
print element
print data
fp = open('TEST', 'w')
try:
fp.write(element)
fp.write(data)
finally:
fp.close()
# yield this output althought the manual states that lists and
# dictionaries are valid as long they are not recursive
Copyright 1990, 1991, 1992 Stichting Mathematisch Centrum, Amsterdam
>>> import mywrite
Atoms.py loaded and ready
{'he': 2, 'b': 5, 'h': 1, 'be': 4, 'li': 3}
[[0, 0, '0'], [1, 1.008, '1s1'], [2, 4.003, '1s2']]
TypeError: illegal argument type for built-in operation
Stack backtrace (innermost last):
File "<stdin>", line 1
File "./mywrite.py", line 14
fp.write(element)
>>>
------- End of forwarded message -------