Happy pythoning!
>
> Cheers,
> Cliff
>
Thanks Cliff,
this is what i need, it seems to make much more sense to do this way. I
think once i learn to include datastructures within each other im gonna
try to make up this 3D 'array' (i think this is a word from C, is there
a python equ
Steve Holden wrote:
> Alistair King wrote:
>
>> Steve Holden wrote:
>>
>>
>>> [EMAIL PROTECTED] wrote:
>>>
>>>
>>>
>>>> J. Clifford Dyer wrote:
>>>>
>>>>
>
Steve Holden wrote:
> [EMAIL PROTECTED] wrote:
>
>> J. Clifford Dyer wrote:
>>
>>
>>> Alistair King wrote:
>>>
>
> [... advice and help ...]
>
>
>> this worked a treat:
>>
>> def monoVarcalc(atom):
>>
&
Gary Herron wrote:
> Alistair King wrote:
>
>> Hi,
>>
>> is there a simple way of creating global variables within a function?
>>
>>
>>
> Use the "global" statement within a function to bind a variable to a
> global.
refox hangs
and wont reopen until i restart. Is this likely to be anything related
to IE7?
--
Dr. Alistair King
Research Chemist,
Laboratory of Organic Chemistry,
Department of Chemistry,
Faculty of Science
P.O. Box 55 (A.I. Virtasen aukio 1)
FIN-00014 University of Helsinki
Tel. +358 9 191 50392
..
it seems to work but again i can only print the values of Xma and Xaa
?
Alistair
--
Dr. Alistair King
Research Chemist,
Laboratory of Organic Chemistry,
Department of Chemistry,
Faculty of Science
P.O. Box 55 (A.I. Virtasen a
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 complicat
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
>
Ben Finney wrote:
> 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
>>> do
ou get to such a program and still don't
> understand, then post it here so others can run it themselves and
> explain.
>
>
ive checked the values and XDS is actually returning a string where i
want a float ie '123.45' not 123.45.
--
Dr. Alistair King
Research Chemist,
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:
>> >>
>> &
, XDS)
updateDS1v(FHas, H, XDS)
updateDS1v(FOas, O, XDS)
updateDS1v(FNas, N, XDS)
updateDS1v(FSas, S, XDS)
updateDS1v(FClas, Cl, XDS)
updateDS1v(FBras, Br, XDS)
updateDS1v(FZnas, Zn, XDS)
print DS1v
I know there is probably a simple solution but im quite new to python and am
lost?
Ali
--
Dr
f the dictionary containing typical elements:
pt = {'H': 1.00794, 'He': 4.002602, 'Li': 6.941, 'Be': 9.012182, 'B':
10.811}
Ali
--
Dr. Alistair King
Research Chemist,
Laboratory of Organic Chemistry,
Department of Chemistry,
Faculty of Scien
thanks to Simon Forman,
his solution worked, the key value pairs were entered the wrong way
round in the dictionary...Doh!
--
Dr. Alistair King
Research Chemist,
Laboratory of Organic Chemistry,
Department of Chemistry,
Faculty of Science
P.O. Box 55 (A.I. Virtasen aukio 1)
FIN-00014
gt; float, in line 142 of your code (in the findClosest function). So the problem
> is
> that 'target' is a float while 'v' is a string.
>
> 'v' should be a float as well, but it's a string since the values in your
> dictionary are strings instead
= abs(z - exvalue)
# Create a var to store the closest key
result = u
# Iterate through the rest of the dict.
for u, z in diter:
# Compute the closeness.
v = abs(z - exvalue)
# Check if it's closer than the closest.
if v < closest:
# If so, store the new closest.
closest = v
# And stor
16 matches
Mail list logo