Re: [BangPypers] How to handle files efficiently in python

2011-03-22 Thread Senthil Kumaran
On Wed, Mar 23, 2011 at 2:24 PM, Senthil Kumaran wrote: > - file IO based. Seek to end of file and do a seek in the reverse >  direction based on a factor matching the size, and process and >  display. ( I found a good discussing on StackOverflow after writing >  this). http://stackoverflow.com/q

Re: [BangPypers] How to handle files efficiently in python

2011-03-22 Thread Senthil Kumaran
briji...@gmail.com wrote: > This a question asked by netApp > At the end of the interview, you could have asked the interviewer himself as what response he was looking for. - subprocess based - use tail. I would go for this. - file IO based. Seek to end of file and do a seek in the reverse dir

Re: [BangPypers] How to handle files efficiently in python

2011-03-22 Thread briji...@gmail.com
* Regrads, Brijith P **NuCore Software Solutions Pvt Ltd* *Mobile: +91 8089703840* Url: *www.nucoreindia.com* Email: *brij...@nucoreindia.com* On 23 March 2011 10:31, Gora Mohanty wrote: > On Wed, Mar 23, 2011 at 10:15 AM, briji...@gmail.com > wrote: > > Hi, >

Re: [BangPypers] How to handle files efficiently in python

2011-03-22 Thread Gora Mohanty
On Wed, Mar 23, 2011 at 10:15 AM, briji...@gmail.com wrote: > Hi, > > I too answered this way to this question. I thought there may be some other > efficient way to handle this situation. [...] Is this a question for students? Otherwise, what is the rationale of doing this in Python? Regards, Go

Re: [BangPypers] How to handle files efficiently in python

2011-03-22 Thread briji...@gmail.com
Hi, I too answered this way to this question. I thought there may be some other efficient way to handle this situation. * Regrads, Brijith P * On 22 March 2011 22:19, Noufal Ibrahim wrote: > On Tue, Mar 22 2011, briji...@gmail.com wrote: > > > Hi All, > > How can I print last fi

[BangPypers] Suggestions over BangPypers Digest, Vol 43, Issue 13

2011-03-22 Thread Subhabrata Banerjee
Sir, Over your question I sent a suggestion that you may kindly refer to Alan Gauld's python Tutorial in http://www.freenetpages.co.uk/hp/alan.gauld/. But the mail bounced. I sent the mail to bangpypers@python.org I have joined the mailing list quite new so I do not know exactly why it bounced. I

Re: [BangPypers] How to handle files efficiently in python

2011-03-22 Thread Noufal Ibrahim
On Tue, Mar 22 2011, briji...@gmail.com wrote: > Hi All, > How can I print last five lines of a file using python. The file may > contain thousands of lines each line may differ in length. [...] You'd have to use some kind of heuristic (a.k.a. dirty hack). Stat the file to find it's size

Re: [BangPypers] How to handle files efficiently in python

2011-03-22 Thread Pradeep Gowda
If you are on Linux/Unix, use the tail command $ tail -n 5 somefile.txt On Tue, Mar 22, 2011 at 11:09 AM, briji...@gmail.com wrote: > Hi All, >        How can I print last five lines of a file using python. The file may > contain thousands of lines each line may differ in length. > > > * > Reg

[BangPypers] How to handle files efficiently in python

2011-03-22 Thread briji...@gmail.com
Hi All, How can I print last five lines of a file using python. The file may contain thousands of lines each line may differ in length. * Regrads, Brijith P * * * ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/

[BangPypers] Reference for BangPypers Digest, Vol 43, Issue 13

2011-03-22 Thread Subhabrata Banerjee
Hi, You can refer to Alan Gauld's Python Tutorial.(* http://www.freenetpages.co.uk/hp/alan.gauld/) * It has excellent tutorial on Regular Expression. Hope this would solve your problem. Best Regards, Subhabrata Banerjee On Tue, Mar 22, 2011 at 4:30 PM, wrote: > Send BangPypers mailing list submi

Re: [BangPypers] Regular Expressions

2011-03-22 Thread Nitin Kumar
use this way r'(/|\\)cmd\.com$' Its raw string stuff which i guess you are missing out. Nitin K On Wed, Mar 16, 2011 at 11:27 PM, Santhosh Edukulla < santhosh.eduku...@gmail.com> wrote: > Hi All, > > I have a list of regular expressions under a file(EX: inp.txt). Then, I > have > another file