Ahh yes you have to put parenthases around the string formatting to
remove the integer using indexes. Thanks, that's just what I needed!
Derek Basch
--
http://mail.python.org/mailman/listinfo/python-list
How can I return:
".666"
from float:
"0.666"
This is what I have so far:
>>> "%.6f" % x
Thanks Everyone,
Derek Basch
--
http://mail.python.org/mailman/listinfo/python-list
Carl Banks wrote:
> But even the clear version isn't as nearly clear and straightforward as
> the nested fors with the counter. I wouldn't forsake that clarity just
> so it isn't "kludgy".
>
>
> Carl Banks
Yeah, looks like using the counters is cleare
> Depending on the types of the containers in question, you could use:
>
> len(zoo) * len(animal)
I think this would give me the total iterations but I wouldn't be able
to get a running count. Correct?
Thanks for the reply,
Derek Basch
--
http://mail.python.org/mailman/l
Fredrik Lundh wrote:
> what's kludgy with using a counter to count things ?
Ohhh, nothing in particular. Just seeing if there is a better way to do
it.
> (the real question here is of course why you need the counter. what's
> the loop doing? if the code you posted is all you have, you can rep
What is the best way to count nested loop iterations? I can only figure
to use an index but that seems kludgy.
index = 0
for animal in zoo:
for color in animal:
index += 1
Thanks,
Derek Basch
--
http://mail.python.org/mailman/listinfo/python-list
s variables is bad because they are not
related to the state of the "PeptideEvaluator". How can I avoid having
to pass the same parameters all over a class? I can';t quite seem to
wrap my head around this one.
Thanks again everyone,
Derek Basch
--
http://mail.python.org/mailman/listinfo/python-list
assed parameter value. Am I on the right track?
Thanks,
Derek Basch
--
http://mail.python.org/mailman/listinfo/python-list
Again!
Derek Basch
--
http://mail.python.org/mailman/listinfo/python-list
Good tip John. Hopefully it will help someone out. Thanks again.
Derek Basch
--
http://mail.python.org/mailman/listinfo/python-list
This one has always bugged me. Is it better to just slap a "self" in
front of any variable that will be used by more than one class method
or should I pass around variable between the methods?
FlamewarNOW!
jk, I really do want other opinions.
Thanks,
Derek
--
http://mail.python.org/mai
Thanks effbot. I knew their had to be something buried in the math
module that could help. ceil() it is!
--
http://mail.python.org/mailman/listinfo/python-list
Given a value (x) that is within the range (1e-1, 1e7) how do I round
(x) up to the closest exact logarithmic decade? For instance:
10**3 = 1000
x = 4978
10**4 = 1
x = 1
Thanks Everyone!
Derek Basch
--
http://mail.python.org/mailman/listinfo/python-list
Thanks again. Here is the finished product. Maybe it will help someone
in the future:
from pylab import *
def log_10_product(x, pos):
"""The two args are the value and tick position.
Label ticks with the product of the exponentiation"""
return '%1i' % (x)
ax = subplot(111)
# Axis sca
Great! That worked fine after I played with it for a bit. One last
question though. How do I label the ticks with the product of the
exponentiation? For instance:
100
instead of
10**2
Thanks for all the help,
Derek Basch
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for the reply. I need a scatter plot though. Can that be done?
--
http://mail.python.org/mailman/listinfo/python-list
Can anyone give any suggestions on how to make a logarithmic (base 10)
x and y axis (loglog) plot in matplotlib? The scatter function doesn't
seem to have any log functionality built into it.
Thanks,
Derek Basch
P.S. I suck at math so feel free to make me feel stupid if it is really
easy
Hello Everyone,
Given:
class A:
def __init__(self):
super(A, self).__init__()
self.dog = "fluffy"
def changeDog(self):
self.dog = "spike"
class B:
def __init__(self):
super(B, self).__init__()
class C(object, A, B):
def __init__(self):
sup
Sorry Peter. I will refrain from nudging in the future. I did spend
time at the interactive prompt and got nothing. Maybe I will have
better luck next time.
--
http://mail.python.org/mailman/listinfo/python-list
bump
--
http://mail.python.org/mailman/listinfo/python-list
f either type from a FieldStorage object? Here is
my attempt at creating the double tuple list (It sucksI know):
print [(key, value) for key, value in form.keys() and form[key].value]
Thanks for the help,
Derek Basch
--
http://mail.python.org/mailman/listinfo/python-list
. You guys always rip my code apart and correct my
style. Even if it is just a stupid one off example.
Thanks everyone,
Derek Basch
--
http://mail.python.org/mailman/listinfo/python-list
ooops you are right. Should have been:
pets = ["cat", "dog", "bird"]
num_pets = 0
for i in pets:
num_pets += 1
print "pet" + "#" + num_pets
That's the problem with one offs. I don't read them :).
--
http://mail.python.org/mailman/listinfo/python-list
Is there a better way to count iterations that this?:
pets = 0
for i in pets:
pets += 1
print "pet" + "#" + pets
Thanks,
Derek Basch
--
http://mail.python.org/mailman/listinfo/python-list
Thanks effbot. I haven't had much use for XML comments so far and I
guess other people haven't either because it seems they are hardly ever
mentioned.
http://groups-beta.google.com/groups?hl=en&lr=&c2coff=1&q=xml+comment+python&qt_s=Search+Groups
--
http://mail.python.org/mailman/listinfo/python
Hello,
If I want minidom to output XHTML that includes normally XML escaped
characters how would I do it?
For instance if I use doc.createCDATASection() I get:
and without the CDATASection:
<!--#include virtual="/top.html" -->
when I really need:
Any suggestions?
Tha
enceScore
A01 1: 1-8 8 1410538.0
A01 1: 2-9 8 1410538.0
-
Thanks everyone.
Derek Basch
--
http://mail.python.org/mailman/listinfo/python-list
Cross post from XML-SIG:
--- Walter Dörwald <[EMAIL PROTECTED]> wrote:
> Martin v. Löwis sagte:
> > Derek Basch wrote:
> > >[...]
> >> How do I get minidom to NOT render an empty script element? Should
I
> submit a bug report?
> >
> > That said,
Martin v. Löwis wrote:
> Derek Basch wrote:
> > XHTML 1.0 specs, Appendix C
> > [EMAIL PROTECTED]
> > C.3 Element Minimization and Empty Element Content
> >
> > Given an empty instance of an element whose content model is not
EMPTY (for
> > example, an e
ndles the element incorrectly and
instantiates the javascript.
How do I get minidom to NOT render an empty script element? Should I submit a
bug report?
Thanks for the help,
Derek Basch
__
Do you Yahoo!?
Yahoo! Small Business - Try our new resour
r the help.
Paul Rubin wrote:
> Derek Basch <[EMAIL PROTECTED]> writes:
>
>>Also, after enabling suEXEC on the apache server the script executes
>>perfectly with the redirect. Can anyone explain this behavior? I
>>would guess that it is related to apache user rights
r? I would guess that it is
related to apache user rights but I can't find any reference to such problems
via Google.
Thanks everyone!,
Derek Basch
-
#! /usr/bin/python
import sys
import cgitb
class Trainer:
def
immediatly. Perhaps I am calling the sleep.py script incorrectly?
Shouldn't it take 10sec to execute since the spawn mode argument is os.P_WAIT?
*Third question*
If I uncomment the second spawn call in test.py I do not get any output to
/tmp/test.out and it also returns immediatly. Can anyone
on the target DBM creation directory
(/var/www/bp/predictor/) are:
drwxr-xr-x 2 bpeters bpeters 4096 Jan 11 14:45 predictor
Can anyone tell me what I need to do to allow the CGI script to create the DBM
in the target directory? That is short of changing
34 matches
Mail list logo