Re: Is there a faster way to do this?

2008-08-06 Thread Boris Borcic
Is your product ID always the 3rd and last item on the line ? Else your output won't separate IDs. And how does output = open(output_file,'w') for x in set(line.split(',')[2] for line in open(input_file)) : output.write(x) output.close() behave ? [EMAIL PROTECTED] wrote: I have a csv fil

Re: Is there a faster way to do this?

2008-08-05 Thread Tomasz Rola
On Tue, 5 Aug 2008, [EMAIL PROTECTED] wrote: > I have a csv file containing product information that is 700+ MB in > size. I'm trying to go through and pull out unique product ID's only > as there are a lot of multiples. My problem is that I am appending the > ProductID to an array and then search

Re: Is there a faster way to do this?

2008-08-05 Thread Roy H. Han
Why not just use sets? a = set() a.add(1) a.add(2) On Tue, Aug 5, 2008 at 10:14 PM, RPM1 <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: >> >> I have a csv file containing product information that is 700+ MB in >> size. I'm trying to go through and pull out unique product ID's only >> as th

Re: Is there a faster way to do this?

2008-08-05 Thread RPM1
[EMAIL PROTECTED] wrote: I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a lot of multiples. My problem is that I am appending the ProductID to an array and then searching through that array each

Re: Is there a faster way to do this?

2008-08-05 Thread Gary Herron
Avinash Vora wrote: On Aug 5, 2008, at 10:00 PM, [EMAIL PROTECTED] wrote: I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a lot of multiples. My problem is that I am appending the ProductID to

Re: Is there a faster way to do this?

2008-08-05 Thread Avinash Vora
On Aug 5, 2008, at 10:00 PM, [EMAIL PROTECTED] wrote: I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a lot of multiples. My problem is that I am appending the ProductID to an array and then sea

Re: Is there a faster way to do this?

2008-08-05 Thread Gary Herron
[EMAIL PROTECTED] wrote: I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a lot of multiples. My problem is that I am appending the ProductID to an array and then searching through that array each

Is there a faster way to do this?

2008-08-05 Thread [EMAIL PROTECTED]
I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a lot of multiples. My problem is that I am appending the ProductID to an array and then searching through that array each time to see if I've seen t

Re: Faster way to do this...

2005-03-03 Thread Timo Virkkala
Harlin Seritt wrote: Roy, I like what you showed: nums = [a for a in range(100)] . My mistake for not expressing my question as well as I should have. Not only am I looking for a way to fill in 100 spots (more or less) in an array er... list, but I'd like to be able to do it in intervals of 2,

Re: Faster way to do this...

2005-03-02 Thread Robert Kern
Will McGugan wrote: Warren Postma wrote: Will McGugan wrote: Isn't that equivalent to simply.. nums= range(100) I remember the day I first realized that 900 lines of some C++ program I was working on could be expressed in three lines of python. Ahh. Lately I've found myself commenting C++ code

Re: Faster way to do this...

2005-03-02 Thread Will McGugan
Warren Postma wrote: Will McGugan wrote: Isn't that equivalent to simply.. nums= range(100) I remember the day I first realized that 900 lines of some C++ program I was working on could be expressed in three lines of python. Ahh. Lately I've found myself commenting C++ code with the equivalent P

Re: Faster way to do this...

2005-03-01 Thread Robert Kern
Harlin Seritt wrote: Roy, I like what you showed: nums = [a for a in range(100)] . My mistake for not expressing my question as well as I should have. Not only am I looking for a way to fill in 100 spots (more or less) in an array er... list, but I'd like to be able to do it in intervals of 2,

Re: Faster way to do this...

2005-03-01 Thread Harlin Seritt
Excellent point Warren. I have been working with Python for about 3 years in all, but only really seriously for about a year. I am still utterly amazed that near everything that takes me about 5 to 20 lines of code can be done in 1, 2 or 3 lines of Python code (when done correctly). It is very frus

Re: Faster way to do this...

2005-03-01 Thread Warren Postma
Will McGugan wrote: Isn't that equivalent to simply.. nums= range(100) I remember the day I first realized that 900 lines of some C++ program I was working on could be expressed in three lines of python. Ahh. Rebirth. Then there was the phase of the python-newbie so enamored of map and lambda.

Re: Faster way to do this...

2005-03-01 Thread Roy Smith
Harlin Seritt <[EMAIL PROTECTED]> wrote: >I've got the following code: > >nums = range(0) >for a in range(100): > nums.append(a) > >Is there a better way to have num initialized to a list of 100 >consecutive int values? Step one would be to change the first line to nums = [] which is simpler a

Re: Faster way to do this...

2005-03-01 Thread Aaron Bingham
Harlin Seritt wrote: I've got the following code: nums = range(0) for a in range(100): nums.append(a) Is there a better way to have num initialized to a list of 100 consecutive int values? You mean like this? nums = range(100) ;-) -- --

Re: Faster way to do this...

2005-03-01 Thread Steve Holden
Harlin Seritt wrote: I've got the following code: nums = range(0) for a in range(100): nums.append(a) Is there a better way to have num initialized to a list of 100 consecutive int values? Why not the simplest solution? a = range(100) regards Steve -- http://mail.python.org/mailman/listinfo/p

Re: Faster way to do this...

2005-03-01 Thread Will McGugan
Harlin Seritt wrote: I've got the following code: nums = range(0) for a in range(100): nums.append(a) Is there a better way to have num initialized to a list of 100 consecutive int values? Isn't that equivalent to simply.. nums= range(100) Will McGugan -- http://mail.python.org/mailman/listinfo/

Faster way to do this...

2005-03-01 Thread Harlin Seritt
I've got the following code: nums = range(0) for a in range(100): nums.append(a) Is there a better way to have num initialized to a list of 100 consecutive int values? Thanks, Harlin -- http://mail.python.org/mailman/listinfo/python-list