> "Tiago Katcipis" <[EMAIL PROTECTED]> wrote
>
> > def newton_divergente(x):
> > return math.pow(x, 1.0/3.0)
> >
> > but when x = -20 it returns this error
> >
> > return math.pow(x, 1.0/3.0)
> > ValueError: math domain error
> >
> > but why is that? is it impossible to calculate -20 ^ (1/3)
Hi all,
How do I replace the same value multiple times without repeating the
same variable name/value repeatedly?
for ex.
some = 'thing'
print '%s %s %s %s' % (some,some,some,some)
in this case, my question is how do i replace "% (some,some,some)" with
something more concise?
thanks in adv
Hi,
I'm doing a Investment implementation project where i need to use the
following data:
http://app.lms.unimelb.edu.au/bbcswebdav/courses/600151_2008_1/datasets/finance/asx_large.csv
I've been instructed to design an investment scheme in python.
The investment scheme i have chosen is based on in
Am 21.05.2008 11:35, Faheem schrieb:
Hi all,
How do I replace the same value multiple times without repeating the
same variable name/value repeatedly?
for ex.
some = 'thing'
print '%s %s %s %s' % (some,some,some,some)
in this case, my question is how do i replace "% (some,some,some)" wit
On Wed, May 21, 2008 at 5:35 AM, Faheem <[EMAIL PROTECTED]> wrote:
> Hi all,
> How do I replace the same value multiple times without repeating the
> same variable name/value repeatedly?
> for ex.
>
> some = 'thing'
> print '%s %s %s %s' % (some,some,some,some)
You can use named parameters, whi
Some other solutions might be
>>> animal = 'cat'
>>> " ".join((animal, ) * 4)
'cat cat cat cat'
>>> animal = 'cat'
>>> print " ".join((animal, ) * 4)
cat cat cat cat
>>>#If you need the string injected into another string
>>> print "My %s's name is ginger." % (" ".join((animal,) * 4))
My cat cat c
On Wed, May 21, 2008 at 5:35 AM, Binish Huma Qadir
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm doing a Investment implementation project where i need to use the
> following data:
> http://app.lms.unimelb.edu.au/bbcswebdav/courses/600151_2008_1/datasets/finance/asx_large.csv
>
> I've been instructed to
st = "String"
print "%s " %st*3
String String String
Does this help?
Kinuthia...
-
Message: 6
Date: Wed, 21 May 2008 15:05:21 +0530
From: Faheem <[EMAIL PROTECTED]>
Subject: [Tutor] String Replacement question
To: tutor@python.org
Message-ID: <[EMAIL PROTECTED]>
On Wed, May 21, 2008 at 10:29 AM, Moishy Gluck <[EMAIL PROTECTED]>
wrote:
> >>> "%s " %st*3
> 'String String String '
> ^
> If you look closely at the end of the string there is an extra space.
>
> >>> " ".join((st, )*3)
> 'String String String'
>
> > On Wed, May 21, 2008 at 5:35 AM, Faheem <[EMAIL PROTECTED]>
> > wrote:
> > > Hi all,
> > > How do I replace the same value multiple times without repeating the
> > > same variable name/value repeatedly?
> > > for ex.
> > >
> > &g
Moishy Gluck wrote:
>>> "%s " %st*3
'String String String '
^
If you look closely at the end of the string there is an extra space.
>>> " ".join((st, )*3)
'String String String'
^
No extra space.
Ah...Okay!
On Wed, May 21, 2008 at
Hi all,
This is a syntax that I've seen on occasion in other people's code:
theme = (VALID_THEMES[0], theme) [ theme in VALID_THEMES ]
I have no idea how this works, or how to go about looking it up. Can
someone enlighten me as to what's happening here?
Many thanks,
Eric
___
well it's true, using list it's scalable too. But It's doesn't looks
friendly to the user to write the document. Syntacticly looks nice to keep
some of the original structure of the html ( I mind, put the thags inside
the document, and so on ).
I'll making some test this days to see what i get,
-- Forwarded message --
From: Moishy Gluck <[EMAIL PROTECTED]>
Date: Wed, May 21, 2008 at 12:00 PM
Subject: Re: [Tutor] syntax question
To: Eric Abrahamsen <[EMAIL PROTECTED]>
You appear to be referring to list comprehension. Here is a link to list
comprehension is the python docs
On Wed, May 21, 2008 at 8:27 AM, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> This is a syntax that I've seen on occasion in other people's code:
>
> theme = (VALID_THEMES[0], theme) [ theme in VALID_THEMES ]
>
> I have no idea how this works, or how to go about looking it up.
This is
On May 21, 2008, at 6:42 AM, Kinuthia Muchane wrote:
st = "String"
print "%s " %st*3
String String String
Does this help?
Another approach is to use dictionaries for string
replacement.
>>> subst = {'some': 'thing'}
>>> print "%(some)s%(some)s%(some)s" % subst
thingthingthing
-jeff
___
On Wed, May 21, 2008 at 5:27 AM, Eric Abrahamsen <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> This is a syntax that I've seen on occasion in other people's code:
>
> theme = (VALID_THEMES[0], theme) [ theme in VALID_THEMES ]
>
> I have no idea how this works, or how to go about looking it up. Can someo
On Wed, May 21, 2008 at 9:39 AM, Jeff Younker <[EMAIL PROTECTED]> wrote:
> On May 21, 2008, at 6:42 AM, Kinuthia Muchane wrote:
>
> st = "String"
> print "%s " %st*3
>>
>> String String String
>
>>
>> Does this help?
>
> Another approach is to use dictionaries for string
> replacement.
multiple values, a common trick is to pass vars() or locals() as
the dict, giving the format access to all defined variables:
In [27]: a=1
In [28]: b=2
In [29]: print '%(a)s %(b)s' % vars()
1 2
If you literally need to repeat as in your example, you could do this:
In [26]: print
On Wed, May 21, 2008 at 12:00 PM, Moishy Gluck <[EMAIL PROTECTED]> wrote:
> You appear to be referring to list comprehension.
No, it is not a list comp. See my separate reply.
Kent
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/
1) When starting a new topic start a new email rather than replying to
another unrelated post.
jatinder Singh wrote:
Hi .
I am trying to change two lines in a single file (etc/php.ini) but my
script is not doing this in one time .
What does "in one time" mean?
What IS the script doin
multiple values, a common trick is to pass vars() or locals() as
the dict, giving the format access to all defined variables:
In [27]: a=1
In [28]: b=2
In [29]: print '%(a)s %(b)s' % vars()
1 2
If you literally need to repeat as in your example, you could do this:
In [26]: print
Can I get list of supported platform by python?
can I install python on AS/400 and HP-Unix?
Regards
Amit
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
I would check the docs on the www.python.org website.
>From the main page
"Python runs on Windows, Linux/Unix, Mac OS X, OS/2, Amiga, Palm Handhelds,
and Nokia mobile phones. Python has also been ported to the Java and .NET
virtual machines."
On Wed, May 21, 2008 at 2:11 PM, Amit Kumar <[E
Faheem wrote:
Hi all,
How do I replace the same value multiple times without repeating the
same variable name/value repeatedly?
for ex.
some = 'thing'
print '%s %s %s %s' % (some,some,some,some)
in this case, my question is how do i replace "% (some,some,some)" with
something more concis
On Wed, May 21, 2008 at 2:11 PM, Amit Kumar <[EMAIL PROTECTED]> wrote:
> Can I get list of supported platform by python?
>
> can I install python on AS/400 and HP-Unix?
I don't know of any sort of official list of supported platforms.
Activestate claims to have a python distribution for HPUX:
htt
> On Wed, May 21, 2008 at 2:11 PM, Amit Kumar <[EMAIL PROTECTED]> wrote:
>> Can I get list of supported platform by python?
See
http://www.python.org/download/
http://www.python.org/download/other
for a partial list.
Kent
___
Tutor maillist - Tutor@p
I've just made an interesting observation, and I'm curious if anyone
knows any more about it.
1 import time
2
3 start = time.time()
4 f = open("test.txt")
5 f.close()
6 end = time.time()
7 print end - start
8
9
10 start = time.time()
11 f = open("/home/wayne/python_files/test/t
Finally, i decide to make this:
from metatag import MetaTag
from htmltools import TagHTML
class Structure(object):
class A(TagHTML):
pass
class B(TagHTML):
pass
def get(self):
__all__ = dir(self)
classes = filter(lambda k: type(getattr(self, k)) == typ
sorry this is not true:
There is a think left, i can't jus compare this:
if type(somethingA) == type(somthingB):
I transform type() to a string and then compare them.. (like in the code
below)
Thanks
___
Tutor maillist - Tutor@python.org
http://mai
On Wed, May 21, 2008 at 12:59 PM, W W <[EMAIL PROTECTED]> wrote:
> Could it be
> that the file is stored in RAM and "remembered" even though it's been
> closed?
Yes, the OS caches file and directory data so the second open is faster.
Kent
___
Tutor mail
I'm using the dir() function, but this give me an alphabetic ordered list,
is there any way to do the same but getting an appearance ordered list ?.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Wed, May 21, 2008 at 7:45 PM, Laureano Arcanio
<[EMAIL PROTECTED]> wrote:
>
> I'm using the dir() function, but this give me an alphabetic ordered list,
> is there any way to do the same but getting an appearance ordered list ?.
Not easily. Attributes are stored in a dict; dicts don't preserve
On Wed, 21 May 2008, Terry Carroll wrote:
> The following (barely-tested) routine should calculate all the Nth roots
> of a given x, even when x is negative and N is even:
I realize I'm probably talking to myself here, but for the benefit of the
archives, I found a more elegant approach after re
34 matches
Mail list logo