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
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
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
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
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/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 clearer. Thanks for the opinions
everyone!
Derek Basch
?
Thanks,
Derek Basch
--
http://mail.python.org/mailman/listinfo/python-list
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
!
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
--
Good tip John. Hopefully it will help someone out. Thanks again.
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 scale
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 effbot. I knew their had to be something buried in the math
module that could help. ceil() it is!
/dTb
--
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 to do
Thanks for the reply. I need a scatter plot though. Can that be done?
--
http://mail.python.org/mailman/listinfo/python-list
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
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):
bump
--
http://mail.python.org/mailman/listinfo/python-list
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
? 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
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
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
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=enlr=c2coff=1q=xml+comment+pythonqt_s=Search+Groups
--
:
!--#include virtual=/top.html --
Any suggestions?
Thanks,
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, I think there is a simple solution: add an empty Text
node
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 resources site
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 empty title or paragraph) do not use the minimized form
for 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 but I can't
find any reference to such problems
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 tell me why?
Thank You Mighty Python Guru's,
Derek Basch
__
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage
of changing everything to root.
Thanks everyone,
Derek Basch
__
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com
--
http://mail.python.org/mailman/listinfo/python-list
32 matches
Mail list logo