I'm new to python and my programming years are a ways behind me, so I
was looking for some help in parsing a file into a chart using the
Google Charts API.
The file is simply a text file containing: Date, Total Accesses,
Unique Accesses.
I'd like date across the bottom, access numbers on the vert
On Sep 3, 12:51 pm, Mike Kent wrote:
> On Sep 3, 1:52 pm, alistair wrote:
>
> > I'm new to python and my programming years are a ways behind me, so I
> > was looking for some help in parsing a file into a chart using the
> > Google Charts API.
>
> Try thi
salias.org/~dstromberg/treap/ - a treap is also
> logn, but has a very good amortized cost because it sacrifices keeping
> things perfectly balanced (and rebalancing, and rebalancing...) to gain
> speed. But still, you might be better off with a short list and min.
Thanks, that's
= 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
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
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
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
, 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
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:
>> >>
>> &
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,
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
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
>
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
......
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
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
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.
Steve Holden wrote:
> [EMAIL PROTECTED] wrote:
>
>> J. Clifford Dyer wrote:
>>
>>
>>> Alistair King wrote:
>>>
>
> [... advice and help ...]
>
>
>> this worked a treat:
>>
>> def monoVarcalc(atom):
>>
&
Steve Holden wrote:
> Alistair King wrote:
>
>> Steve Holden wrote:
>>
>>
>>> [EMAIL PROTECTED] wrote:
>>>
>>>
>>>
>>>> J. Clifford Dyer wrote:
>>>>
>>>>
>
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
19 matches
Mail list logo