Re: parsing csv files class

2008-12-30 Thread alex goretoy
This line doesn't work for me. bufferp is empty afterwards. self.bufferp= [dict(zip(header,line)) for line in reader] needs to be this self.bufferp= [dict(zip(header,line)) for line in self.buffer] after reading from the reader, it becomes empty. Figured maybe someone would find this info

Re: parsing csv files class

2008-12-30 Thread Tim Roberts
alex goretoy aleksandr.gore...@gmail.com wrote: This line doesn't work for me. bufferp is empty afterwards. self.bufferp= [dict(zip(header,line)) for line in reader] needs to be this self.bufferp= [dict(zip(header,line)) for line in self.buffer] Yes, when I was writing this, I started out

Re: parsing csv files class

2008-12-28 Thread alex goretoy
Tim, Thank you for your suggestions that you made. I will modify my class to what you said. I will also remove find_and_replace. seeing as I won't use it anywhere else. I think I put it there for some test and forgot to delete it. I was actually deleting the header outside of the class. This works

parsing csv files class

2008-12-27 Thread alex goretoy
Hello All, I have this class that I use in one of my projects. I know it's missing functionality and some things could have been done differently. Can you ehlp me make this class better? What can I do to make it more resistant to error? You can find the stdout_colours class on Google if you want

Re: parsing csv files class

2008-12-27 Thread alex goretoy
I know it's messy with all those self.soc.* functions, but it works in one of my current project. I just want to make it more pythonic I also want to add capability for makeing csv file if I give it input like: 1234,something nice, hey this is something nice 2468,something else, something else On

Re: parsing csv files class

2008-12-27 Thread Gary M. Josack
alex goretoy wrote: I know it's messy with all those self.soc.* functions, but it works in one of my current project. I just want to make it more pythonic I also want to add capability for makeing csv file if I give it input like: 1234,something nice, hey this is something nice 2468,something

Re: parsing csv files class

2008-12-27 Thread Chris Rebert
On Sat, Dec 27, 2008 at 5:02 AM, Gary M. Josack g...@byoteki.com wrote: alex goretoy wrote: I know it's messy with all those self.soc.* functions, but it works in one of my current project. I just want to make it more pythonic I also want to add capability for makeing csv file if I give it

Re: parsing csv files class

2008-12-27 Thread Gabriel Genellina
En Sat, 27 Dec 2008 11:02:13 -0200, Gary M. Josack g...@byoteki.com escribió: alex goretoy wrote: I know it's messy with all those self.soc.* functions, but it works in one of my current project. I just want to make it more pythonic I also want to add capability for makeing csv file if I

Re: parsing csv files class

2008-12-27 Thread alex goretoy
It's main concern is to grab the file into the buffer for use in other classes. The self.soc.me_him is just so I know when its ENTERING or EXITING in that function when I run it in terminal. It's prints it in color. My main concern right now is to add error handling. I'm still learning how to use

Re: parsing csv files class

2008-12-27 Thread alex goretoy
I might as well add a UnicodeReader and UnicodeWriter and support for passing delimiter in from other classes. At the same time. Anyone have a good csv class I can pick thru? I'm planning on posting my mysql adn curl classes that I use in my projects I just want to make them better and have less

Re: parsing csv files class

2008-12-27 Thread alex goretoy
How would I change this to work with numpy: (Would it be more feasible for storing big files? 300-30,000 records) for row in reader: self.buffer.append(row) s,a=[],{} for j in range(len(self.buffer[0])):

Re: parsing csv files class

2008-12-27 Thread Tim Roberts
alex goretoy aleksandr.gore...@gmail.com wrote: class parsercsvy(object): Return a line from a csv file or total amount of lines def __init__(self,file_name=): self.func_me_color=white_on_black self.soc=stdout_colours.stdout_colors()