Re: dict problem

2006-10-30 Thread Ben Finney
Alistair King <[EMAIL PROTECTED]> writes: > heavy = raw_input("\n\n@@\n\nPlease enter the heaviest > atom for which you obtained percentage values for, but not Oxygen, eg, > 'C', 'N', 'S', 'Br'...: ") > > print DSvalues > > def updateDS1v(Fxas, x): > if Fxas != 0: > value = DSvalue

Re: dict problem

2006-10-30 Thread Alistair King
Peter Otten wrote: > Alistair King wrote: > > >> the code works great now. I know these things are quite simple to learn >> from books etc.. but i would be lost without this mailinglist, from lack >> of time. Hopefully soon i can give something more complicated. >> I ended up doing the dictionar

Re: dict problem

2006-10-30 Thread Peter Otten
Alistair King wrote: > the code works great now. I know these things are quite simple to learn > from books etc.. but i would be lost without this mailinglist, from lack > of time. Hopefully soon i can give something more complicated. > I ended up doing the dictionary formatting properly and the n

Re: dict problem

2006-10-30 Thread Alistair King
Fredrik Lundh wrote: > Alistair King wrote: > > >> Is there any other way of removing double and single quotes from a >> number, as a string, to give the float value again? >> > > help(str) describes what you can do with a string (an object of type > 'str', that is). among the methods lis

Re: dict problem

2006-10-30 Thread Fredrik Lundh
Alistair King wrote: > Is there any other way of removing double and single quotes from a > number, as a string, to give the float value again? help(str) describes what you can do with a string (an object of type 'str', that is). among the methods listed, you'll find: > | strip(...) > |

Re: dict problem

2006-10-25 Thread Ben Finney
Alistair King <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > Even better, work on a minimal program to do nothing but reproduce > > the unexpected behaviour. If you get to such a program and still > > don't understand, then post it here so others can run it > > themselves and explain. > ive c

Re: dict problem

2006-10-25 Thread Alistair King
Ben Finney wrote: > "Jon Clements" <[EMAIL PROTECTED]> writes: > > >> We're still in the dark as to what you're trying to do, try >> describing something like: "for each element there is an associated >> 'F' value. For each element in an existing molecule I wish to change >> the number of 'whate

Re: dict problem

2006-10-25 Thread Ben Finney
"Jon Clements" <[EMAIL PROTECTED]> writes: > We're still in the dark as to what you're trying to do, try > describing something like: "for each element there is an associated > 'F' value. For each element in an existing molecule I wish to change > the number of 'whatever' to be 'whatever' + my 'F'

Re: dict problem

2006-10-25 Thread Jon Clements
Alistair King wrote: > Jon Clements wrote: > > > > Alistair King wrote: > > > > > > > > > >> >> Hi, > >> >> > >> >> ive been trying to update a dictionary containing a molecular formula, > >> >> but seem to be getting this error: > >> >> > >> >> > >> >> Traceback (most recent call last): > >> >>

Re: dict problem

2006-10-25 Thread Jon Clements
Alistair King wrote: > Hi, > > ive been trying to update a dictionary containing a molecular formula, but > seem to be getting this error: > > > Traceback (most recent call last): > File "DS1excessH2O.py", line 242, in ? > updateDS1v(FCas, C, XDS) > NameError: name 'C' is not defined > > d

Re: dict problem

2006-10-25 Thread Peter Otten
Alistair King wrote: > Hi, > > ive been trying to update a dictionary containing a molecular formula, but > seem to be getting this error: > > > Traceback (most recent call last): > File "DS1excessH2O.py", line 242, in ? > updateDS1v(FCas, C, XDS) > NameError: name 'C' is not defined > >

Re: dict problem

2006-10-25 Thread Roberto Bonvallet
Roberto Bonvallet wrote: > Alistair King wrote: >> DS1v = {'C': 6, 'H': 10, 'O': 5} > > Try DS1v['C'] instead of DS1v[C]. > updateDS1v(FCas, C, XDS) > updateDS1v(FHas, H, XDS) > updateDS1v(FOas, O, XDS) > updateDS1v(FNas, N, XDS) > updateDS1v(FSas, S, XDS) > updateDS1v(FClas, Cl, XDS) > updateDS1

Re: dict problem

2006-10-25 Thread Roberto Bonvallet
Alistair King wrote: > Hi, > > ive been trying to update a dictionary containing a molecular formula, but > seem to be getting this error: > > > Traceback (most recent call last): > File "DS1excessH2O.py", line 242, in ? >updateDS1v(FCas, C, XDS) > NameError: name 'C' is not defined > > d