Re: [Tutor] Function design

2009-10-27 Thread Eduardo Vieira
On Tue, Oct 27, 2009 at 10:14 AM, Dave Angel wrote: > > But if the file contained  0.00 as one of its items, this code would still > have the other problem I mentioned. > > DaveA > ___ > Tutor maillist  -  tu...@python.org > To unsubscribe or change sub

Re: [Tutor] Function design

2009-10-27 Thread Eduardo Vieira
On Tue, Oct 27, 2009 at 10:14 AM, Dave Angel wrote: > Benno Lang wrote: >> >> On Tue, Oct 27, 2009 at 8:21 AM, Dave Angel wrote: >> >>> >>> I agree with Luke's comments.  But I'd like to point out an apparent bug >>> (I >>> haven't tried the code, this is just by inspection). >>> >>> You use the

Re: [Tutor] Function design

2009-10-27 Thread Dave Angel
Benno Lang wrote: On Tue, Oct 27, 2009 at 8:21 AM, Dave Angel wrote: I agree with Luke's comments. But I'd like to point out an apparent bug (I haven't tried the code, this is just by inspection). You use the test if '0' in row[.] that's not going to check for a zero value, it's g

Re: [Tutor] Function design

2009-10-27 Thread Benno Lang
On Tue, Oct 27, 2009 at 8:21 AM, Dave Angel wrote: > I agree with Luke's comments.  But I'd like to point out an apparent bug (I > haven't tried the code, this is just by inspection). > > You use the test >     if '0' in row[.] > > that's not going to check for a zero value, it's going to chec

Re: [Tutor] Function design

2009-10-26 Thread Alan Gauld
"Eduardo Vieira" wrote def zerofound(csvfile, outputfile, lastcolumn ): """Finds columns with zero prices. Column have 0 index""" final = csv.writer(open(outputfile, 'wb'), dialect='excel') reader = csv.reader(open(csvfile, 'rb'), dialect='excel') for row in reader: if '0'

Re: [Tutor] Function design

2009-10-26 Thread Dave Angel
Luke Paireepinart wrote: On Mon, Oct 26, 2009 at 2:08 PM, Eduardo Vieira wrote: Hello, I need your help in designing a function. I have created this script to check out if certain column in some csv files has value "0": import csv def zerofound(csvfile, outputfile, lastcolumn ): """Find

Re: [Tutor] Function design

2009-10-26 Thread Luke Paireepinart
On Mon, Oct 26, 2009 at 2:08 PM, Eduardo Vieira wrote: > Hello, I need your help in designing a function. I have created this > script to check out if certain column in some csv files has value "0": > > import csv > > def zerofound(csvfile, outputfile, lastcolumn ): >"""Finds columns with zero

[Tutor] Function design

2009-10-26 Thread Eduardo Vieira
Hello, I need your help in designing a function. I have created this script to check out if certain column in some csv files has value "0": import csv def zerofound(csvfile, outputfile, lastcolumn ): """Finds columns with zero prices. Column have 0 index""" final = csv.writer(open(outputf