Re: [Tutor] writing files using modules and functions

2012-11-13 Thread Alan Gauld
On 13/11/12 06:43, Rufino Beniga wrote: def MatInv(arr,file): f = open('file.txt','w') f.write(arr) f.close() So I'm trying to write a module that will take a matrix (arr) and write it to a text file. The above module is called MatrixIO.py #first I import it import MatrixIO #Th

Re: [Tutor] Questions about classes

2012-11-13 Thread Dave Angel
On 11/12/2012 09:49 PM, brandon w wrote: > I have been trying to understand classes. I have been studying from a book > I picked up recently. > I have two questions about them. > > 1. I saw in the book an assignment written like this: > > class HumanBeing: > def makeName(self, name): >

Re: [Tutor] writing files using modules and functions

2012-11-13 Thread Dave Angel
On 11/13/2012 01:43 AM, Rufino Beniga wrote: > def MatInv(arr,file): > f = open('file.txt','w') > f.write(arr) > f.close() > > So I'm trying to write a module that will take a matrix (arr) and write it > to a text file. > The above module is called MatrixIO.py > > #first I import it > >

[Tutor] mapping list appends to correct position for csv output

2012-11-13 Thread Norman Khine
hello, i am trying to create a csv file in python and map the fields to a pre-existing fields, here is the title fileds of my csv c = csv.writer(open("adm_products.csv", "wb"), delimiter='\t', quotechar='"', quoting=csv.QUOTE_ALL) import_fields = ["ID", "Active (0/1)", "Name *", "Categories (x,y

Re: [Tutor] Questions about classes

2012-11-13 Thread Alan Gauld
On 13/11/12 02:49, brandon w wrote: class HumanBeing: def makeName(self, name): * self.name = name * * Why is it not written like this?: class HumanBeing: def makeName(self, name): * name = self.name Because they two completely different things :

Re: [Tutor] functions and iterations

2012-11-13 Thread Alan Gauld
On 13/11/12 03:56, Rufino Beniga wrote: def IterateLogistic(x,r,n): for i in xrange(n): x = r*(1-x) if i = n: print x DogWalker has answered your basic question. But you don't really need the test at all. Just print x after the loop finishes: def IterateL

Re: [Tutor] mapping list appends to correct position for csv output

2012-11-13 Thread Alan Gauld
On 13/11/12 09:50, Norman Khine wrote: also which is more efficient: c.writerow(adm_product) # writing the product to the csv when all the fileds are found or products = [] # adding them to a list first and then writing them to the csv products.append(adm_product) c.writerow(x) for x in produ

Re: [Tutor] Questions about classes

2012-11-13 Thread Steven D'Aprano
On 13/11/12 13:49, brandon w wrote: 1. I saw in the book an assignment written like this: class HumanBeing: def makeName(self, name): *self.name = name* * * Why is it not written like this?: class HumanBeing: def makeName(self, name): * na

Re: [Tutor] Parsing a multi-line/record text file

2012-11-13 Thread wolfrage8...@gmail.com
On Sun, Nov 11, 2012 at 6:01 AM, Marc wrote: > ** > > Hello, > > I am trying to parse a text file with a structure that looks like: > > [record: Some text about the record] > > Attribute 1 = Attribute 1 text > > Attribute 3 = Attribute 3 text > > Attribute 4 = Attribute 4

[Tutor] Reusing Timers (threading.timer)

2012-11-13 Thread Patrick Dickey
Hi everyone, I've got an application that will use a timer to run a function automatically (it's an update function for my IPv6 endpoint). The questions that I have are these: 1. Can I stop and start the timer from different functions or methods in my program, and if so, how? 2. Can I stop the

Re: [Tutor] Reusing Timers (threading.timer)

2012-11-13 Thread Alan Gauld
On 13/11/12 15:42, Patrick Dickey wrote: > 1. Can I stop and start the timer from different functions or methods > in my program, and if so, how? > 2. Can I stop the timer, change the value, and restart it (or would it > create a new timer), or do I have to create a new timer with an entirely >

Re: [Tutor] Questions about classes

2012-11-13 Thread Ciaran Mooney
Hi, Was hoping someone could help me. I have downloaded the latest pygame 1.9.1 i think) to a Mac powerbook OS 10.4.11. Python 3 does not recognise pygame although python 2.7 version does (unfortunately have never programmed python 2.7 and don't no how). Any help would be much appreciated. T

Re: [Tutor] Questions about classes

2012-11-13 Thread Steven D'Aprano
On 14/11/12 09:50, Ciaran Mooney wrote: Hi, Was hoping someone could help me. I have downloaded the latest pygame 1.9.1 i think) to a Mac powerbook OS 10.4.11. What does this question have to do with classes? When starting a brand new discussion, start with a brand new email thread: * do NOT

Re: [Tutor] Reusing Timers (threading.timer)

2012-11-13 Thread Steven D'Aprano
On 14/11/12 02:42, Patrick Dickey wrote: Hi everyone, I've got an application that will use a timer to run a function automatically (it's an update function for my IPv6 endpoint). The questions that I have are these: Have you read the documentation? http://docs.python.org/2/library/threading.

[Tutor] data analysis with python

2012-11-13 Thread David Martins
Hi All I'm trying to use python for analysing data from building energy simulations and was wondering whether there is way to do this without using anything sql like. The simulations are typically run for a full year, every hour, i.e. there are 8760 rows and about 100+ variables such as exter

Re: [Tutor] data analysis with python

2012-11-13 Thread Andre' Walker-Loud
Hi David, > I'm trying to use python for analysing data from building energy simulations > and was wondering whether there is way to do this without using anything sql > like. > > The simulations are typically run for a full year, every hour, i.e. there are > 8760 rows and about 100+ variable

Re: [Tutor] data analysis with python

2012-11-13 Thread Ryan Waples
Not sure how stuck you are to python (I have no doubt it can tackle this) but this is very much the sort of thing that 'R' is *really* good at. Just FYI. Good luck Ryan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: