Re: [Tutor] Adding Value to CSV

2009-10-31 Thread Alan Gauld
"Paras K." wrote When I have the line that has been read I need to add another value at the end of it, or write the information into another csv file If you are dealing with csv fioles you should look at using the csv module. for line in fh.readlines(): readline = line

[Tutor] Adding Value to CSV

2009-10-31 Thread Paras K.
I have some code that is going through a number of test. When I have the line that has been read I need to add another value at the end of it, or write the information into another csv file Example of my code: for line in fh.readlines(): readline = line ipline = readline

Re: [Tutor] Accessing variables in main from functions in a module

2009-10-31 Thread Robert Lummis
These replies are great! Thanks to everyone who took the trouble to respond and explain. I'll need some time to digest what you say and put it to use but I'm sure your suggestions will be a huge help. On Fri, Oct 30, 2009 at 7:55 PM, Alan Gauld wrote: > "Robert Lummis" wrote > >> I want to move

[Tutor] Structure of my simulation / monte-carlo

2009-10-31 Thread Vincent Davis
I ask this question in part because of a fee remarks from another question I ask "class attribute to initiate more classes" Basically I am simulation the process of applicants to schools and trying to ask/answer some questions like "what conditions do you need to have an optimal solution" Oh and t

Re: [Tutor] class attribute to initiate more classes

2009-10-31 Thread Vincent Davis
> > > Vincent Davis wrote: > >> DaveA posted >> import random, functools >> >> class Person: >>def __init__(self, size): >>self.size = size >> >>def __str__(self): >>return "Person of size %s" % self.size >> >> class MakePeople: >>def __init__(self, random_func):

Re: [Tutor] class attribute to initiate more classes

2009-10-31 Thread Dave Angel
(You top-posted, which confuses the sequence of message text. So I clipped it off and posted my message at the bottom, which is the convention on this newsgroup) Vincent Davis wrote: DaveA posted import random, functools class Person: def __init__(self, size): self.size = size

Re: [Tutor] class attribute to initiate more classes

2009-10-31 Thread Vincent Davis
DaveA posted import random, functools class Person: def __init__(self, size): self.size = size def __str__(self): return "Person of size %s" % self.size class MakePeople: def __init__(self, random_func): self.random_func = random_func def make_the

Re: [Tutor] class attribute to initiate more classes

2009-10-31 Thread Kent Johnson
On Sat, Oct 31, 2009 at 1:01 AM, Vincent Davis wrote: > I have a program that generates many instances of a class with an attribute > self.x = random.gauss(10, 2). So each instance has a different value for > self.x. This is what I want. Now I want to make a class that starts my > program and sets

Re: [Tutor] problem adding Tkinter

2009-10-31 Thread Alan Gauld
"Kristin Wilcox" wrote [This is my problem:] I've been using IDLE successfully to do very very simple exercises in Python, and now I wanted to start on some very simple exercises including the Tkinter library. Which vwersuion of Python are you using? In version 3 Tkinter has been renamed to

Re: [Tutor] class attribute to initiate more classes

2009-10-31 Thread Dave Angel
Vincent Davis wrote: I have a program that generates many instances of a class with an attribute self.x = random.gauss(10, 2). So each instance has a different value for self.x. This is what I want. Now I want to make a class that starts my program and sets the attributes. class people: def _