On 02/07/2008, Christopher Spears <[EMAIL PROTECTED]> wrote:
> File "point.py", line 13, in __str__
> point_str = "(%f,%f)" % self.x, self.y
> TypeError: not enough arguments for format string
>
> Does anyone know what is wrong? I'm sure it is something obvious, but I
> can't see it.
Hi
On Jul 2, 2008, at 12:36 PM, Christopher Spears wrote:
I'm working on problem 13-5 in Core Python Programming (2nd
Edition). I am supposed to create point class. Here is what I have
so far:
#!/usr/bin/python
class Point(object):
def __init__(self, x=0.0,y=0.0):
self.x = float(
I'm working on problem 13-5 in Core Python Programming (2nd Edition). I am
supposed to create point class. Here is what I have so far:
#!/usr/bin/python
class Point(object):
def __init__(self, x=0.0,y=0.0):
self.x = float(x)
self.y = float(y)
def __repr__(self)
"asdg asdg" <[EMAIL PROTECTED]> wrote
You need to add the folder containing this module to your
PYTHONPATH.
Being picky you want to add it to your sys.path value
Python loads sys.path from the values in PYTHONPATH which is
an OS environment variable. Modifying PYTHONPATH after you
start Pyth
Forwarding to the list with my reply. (Please use reply all to reply
to the list)
On Tue, Jul 1, 2008 at 11:36 AM, S Potter <[EMAIL PROTECTED]> wrote:
> Kent,
>
> Thanks for the response the answer to question 2 helped. It seem python is
> much less verbose than I anticipate at times.
>
> As for m
To all;
Since this was my first time using this resource I just wanted to extend my
thanks for the many responses/explanations.
I'm actually not using much of a tutorial but I will look over the links
provided herein. I did make a mistake in my question post
I wasn't using a dictionary but a so
You need to add the folder containing this module to your PYTHONPATH.
To do this, go to you interpreter and type:
>>> import sys
>>> sys.path.append("C:\Python25\ExampleFolder")
That path was just an example, insert your own path leading to the desired
folder there.
Python imports it's modules
At 06:23 AM 7/1/2008, Cédric Lucantis wrote:
Le Tuesday 01 July 2008 15:04:11 Dick Moores, vous avez écrit :
> At 05:43 AM 7/1/2008, Tim Golden wrote:
> >Dick Moores wrote:
> >>So I want to randomly choose between them. I thought that I might
> >>be able to use choice() to do that. So,
> >>
Hi,
I am studying "thinking like a computer scientist using Python". chapter 4
importing turtleworld is kind of a hitch 4 me .I downloaded the swampy module
and when importing, the interpreter gives am error saying this module does not
exist what do i do? i saved the swampy folder in the Python
Le Tuesday 01 July 2008 15:04:11 Dick Moores, vous avez écrit :
> At 05:43 AM 7/1/2008, Tim Golden wrote:
> >Dick Moores wrote:
> >>So I want to randomly choose between them. I thought that I might
> >>be able to use choice() to do that. So,
> >> (bunch of functions here)
> >>if __name__ == '_
Dick Moores wrote:
At 05:43 AM 7/1/2008, Tim Golden wrote:
Dick Moores wrote:
So I want to randomly choose between them. I thought that I might be
able to use choice() to do that. So,
(bunch of functions here)
if __name__ == '__main__':
choice([use_for_float_demo(), use_for_integer_de
Alan Gauld wrote:
"Norman Khine" <[EMAIL PROTECTED]> wrote
Frankly I'd use a database. Just load the data into it using Python.
Then execute SQL querioes to get the counts etc.
Not really an option to use SQL just for this.
I'm curious why?
It seems to suggest that using SQL is somehow a
At 05:52 AM 7/1/2008, Cédric Lucantis wrote:
Le Tuesday 01 July 2008 14:38:36 Dick Moores, vous avez écrit :
> I'm writing a demonstration version of a program which does things
> with integers, and with floats, which are randomly generated. I want
> to also randomly pick whether the integer side
At 05:43 AM 7/1/2008, Tim Golden wrote:
Dick Moores wrote:
So I want to randomly choose between them. I thought that I might
be able to use choice() to do that. So,
(bunch of functions here)
if __name__ == '__main__':
choice([use_for_float_demo(), use_for_integer_demo()])
I find that w
Le Tuesday 01 July 2008 14:38:36 Dick Moores, vous avez écrit :
> I'm writing a demonstration version of a program which does things
> with integers, and with floats, which are randomly generated. I want
> to also randomly pick whether the integer side, or the float side is
> demonstrated next. I h
Dick Moores wrote:
So I want to randomly choose between them. I thought that I might be
able to use choice() to do that. So,
(bunch of functions here)
if __name__ == '__main__':
choice([use_for_float_demo(), use_for_integer_demo()])
I find that what's gets run each time is BOTH of
On Tue, Jul 1, 2008 at 7:03 AM, Norman Khine <[EMAIL PROTECTED]> wrote:
> Kent Johnson wrote:
>> for first in x:
>> for second in y:
>>if first and second and (first, second) in table:
>
> I don't really see this clearly as I may have n'th values for 'x' and n'th
> values for 'y' so I will nee
"S Potter" <[EMAIL PROTECTED]> wrote
How do I filter my first list based upon the selected position
or a variable equal to the value of the selected position from
my second list?
The most common way of filtering a list is to use a list comprehension
filteredList = [item if ]
where can be
On Tue, Jul 1, 2008 at 7:51 AM, S Potter <[EMAIL PROTECTED]> wrote:
> Question 1.)
> I have dictionary or list containing multiple instances 'duplicate
> entries' of the same information. Lets say it's a list of addresses and list
> item i[0] contains city values equal to 'Albany' .
>
> I
I'm writing a demonstration version of a program which does things
with integers, and with floats, which are randomly generated. I want
to also randomly pick whether the integer side, or the float side is
demonstrated next. I have 2 functions, use_for_integer_demo()
and use_for_float_demo(), a
Le Tuesday 01 July 2008 13:51:24 S Potter, vous avez écrit :
> To whom it may concern;
>
> I am a just experimenting with Python and learning as I go. The majority of
> my stumbling blocks have been syntax. So with that I must ask a couple of
> technical albeit probably very simple questions. Hopef
"W W" <[EMAIL PROTECTED]> wrote
Testing your example, Alan, you have it defaulted to "delete",
correct? That's where the "not confirmation" part comes in? I just
tried it in a simple function:
Correct. Purely an arbitrary choice.
def confirm(iput): #I wasn't sure if input was "reserved"
"Norman Khine" <[EMAIL PROTECTED]> wrote
Frankly I'd use a database. Just load the data into it using
Python.
Then execute SQL querioes to get the counts etc.
Not really an option to use SQL just for this.
I'm curious why?
It seems to suggest that using SQL is somehow a big deal?
But with
To whom it may concern;
I am a just experimenting with Python and learning as I go. The majority of my
stumbling blocks have been syntax. So with that I must ask a couple of
technical albeit probably very simple questions. Hopefully, you may provide me
some insight and help me on my way.
Que
On Tue, Jul 1, 2008 at 6:27 AM, Alan Gauld <[EMAIL PROTECTED]> wrote:
> "Kent Johnson" <[EMAIL PROTECTED]> wrote
>>>
>>> if isinstance(x, list):
>>> for item in x:
>>> x = item
>>
>> This just assigns x to the last element of the list
>
> Oops, yes, I said
Kent Johnson wrote:
On Tue, Jul 1, 2008 at 3:09 AM, Norman Khine <[EMAIL PROTECTED]> wrote:
x = getattr(brain, horizontal)
if isinstance(x, list):
for item in x:
x = item
This just assigns x to the last element of the list, it doesn't
Hi,
Alan Gauld wrote:
"Norman Khine" <[EMAIL PROTECTED]> wrote
Here is the 'full' code as such which gets the data from the files.
Unfortunately trying to read this is still difficult since we don't
know what the structure of x, horizontal_criterias, vertical_criterias,
or brains is like.
"Kent Johnson" <[EMAIL PROTECTED]> wrote
if isinstance(x, list):
for item in x:
x = item
This just assigns x to the last element of the list
Oops, yes, I said the first but in fact reassigning x does
not stop the loop, it seems the loop works on a
On Tue, Jul 1, 2008 at 5:25 AM, W W <[EMAIL PROTECTED]> wrote:
> You might find this study/links to be helpful! We just had a
> discussion on this very concept, my guess is that you'll find the
> results informative, and especially helpful.
There is also an interesting recent thread on comp.lang.
On Tue, Jul 1, 2008 at 3:09 AM, Norman Khine <[EMAIL PROTECTED]> wrote:
>x = getattr(brain, horizontal)
>if isinstance(x, list):
>for item in x:
>x = item
This just assigns x to the last element of the list, it doesn't
process the whole
Just a tidbit:
A neat function my friend came up with last year to figure out the
length of a whole number (now converted to python for your viewing
pleasure):
from math import log10 as log
from math import floor
def findNumberLength(number):
number = float(number)
x = log(number)
x
> On Tuesday 01 July 2008 00:12, Shrutarshi Basu wrote:
>>I've been
>> using string concatenation to read through the string, and then create
>> the new one based on a dictionary lookup. However it becomes very slow
>> once the string gets very long (several thousand characters). Part of
>> it is
On Tue, Jul 1, 2008 at 3:47 AM, Alan Gauld <[EMAIL PROTECTED]> wrote:
> But I find the in technique more flexible.
>
> If you go with the default approach the test becomes:
>
> if confirmation in 'yY' or not confirmation:
> # go ahead and delete them
That's slightly different, but basically th
"David" <[EMAIL PROTECTED]> wrote
Thats better.
Now on a wee usability aspect:
confirmation = raw_input('Confirm removal: ')
You might want to print the list of files before asking the
question. Although if its a likely to be a long list maybe just
say how many files - it gives the user a
"Norman Khine" <[EMAIL PROTECTED]> wrote
Here is the 'full' code as such which gets the data from the files.
Unfortunately trying to read this is still difficult since we don't
know what the structure of x, horizontal_criterias,
vertical_criterias,
or brains is like.
## Classify t
Thankyou cedric!
On 6/29/08, Saad Javed <[EMAIL PROTECTED]> wrote:
> I transfer files a lot between my windows and linux partitions...these
> folders sometimes contain *.db and *.ini files which are not recognized or
> used by linux. So i tried to write a program to crawl through my home dir
> and
Hi,
Here is the 'full' code as such which gets the data from the files.
## Classify the users
table = {}
table[('', '')] = 0
for x in horizontal_criterias:
table[(x['id'], '')] = 0
for y in vertical_criterias:
table[('', y['id'])] =
37 matches
Mail list logo