Re: File Handling Problem

2009-09-06 Thread joy99
On Sep 5, 11:49 am, Chris Rebert c...@rebertia.com wrote: On Fri, Sep 4, 2009 at 11:39 PM, SUBHABRATABANERJEEsubhakolkata1...@gmail.com wrote: snip And one small question does Python has any increment operator like ++ in C. No. We do  x += 1  instead. Cheers, Chris

Re: File Handling Problem

2009-09-05 Thread SUBHABRATA BANERJEE
Dear Sir, Thank you for your kind reply. I would surely check your code. Meanwhile, I solved it using readlines() but not in your way. I will definitely have a look in your code. My solution came so smart that I felt I should not have posted this question. But I would like to know about, i)

Re: File Handling Problem

2009-09-05 Thread Chris Rebert
On Fri, Sep 4, 2009 at 11:39 PM, SUBHABRATA BANERJEEsubhakolkata1...@gmail.com wrote: snip And one small question does Python has any increment operator like ++ in C. No. We do x += 1 instead. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list

File Handling Problem

2009-09-04 Thread joy99
Dear Group, I have a file. The file has multiple lines. I want to get the line number of any one of the strings. Once I get that I like to increment the line number and see the string of the immediate next line or any following line as output. The problem as I see is nicely handled in list, like

Re: File Handling Problem

2009-09-04 Thread Lucas Prado Melo
On Fri, Sep 4, 2009 at 9:50 AM, joy99 subhakolkata1...@gmail.com wrote: Dear Group, I have a file. The file has multiple lines. I want to get the line number of any one of the strings. Once I get that I like to increment the line number and see the string of the immediate next line or any

Re: File Handling Problem

2009-09-04 Thread Rami Chowdhury
f = open(myfile.txt, r) list_one = f.read().splitlines() f.close() Or use f.readlines(), which would do the same thing IIRC? On Fri, 04 Sep 2009 07:46:42 -0700, Stephen Fairchild someb...@somewhere.com wrote: joy99 wrote: Dear Group, I have a file. The file has multiple lines. I want

Re: File handling problem.

2009-05-03 Thread SUBHABRATA BANERJEE
Dear Group, I am working on a code like the following: from decimal import* #SAMPLE TEST PROGRAM FOR FILE def sample_file_test(n): #FILE FOR STORING PROBABILITY VALUES open_file=open(/python26/Newfile1.txt,r+) #OPENING OF ENGLISH CORPUS

Re: File handling problem.

2009-05-03 Thread Chris Rebert
On Sun, May 3, 2009 at 9:51 AM, SUBHABRATA BANERJEE subhakolkata1...@gmail.com wrote: Dear Group, I am working on a code like the following: from decimal import* #SAMPLE TEST PROGRAM FOR FILE def sample_file_test(n):     #FILE FOR STORING PROBABILITY VALUES    

Re: File handling problem.

2009-05-03 Thread SUBHABRATA BANERJEE
Dear Sir, Thanx for your prompt reply, I would be trying to work on your suggestion and get back to you as soon as possible. Best Regards, Subhabrata. On Sun, May 3, 2009 at 10:47 PM, Chris Rebert c...@rebertia.com wrote: On Sun, May 3, 2009 at 9:51 AM, SUBHABRATA BANERJEE

File handling problem.

2009-05-02 Thread subhakolkata1234
Dear Group, I am using Python2.6 and has created a file where I like to write some statistical values I am generating. The statistical values are generating in a nice way, but as I am going to write it, it is not taking it, the file is opening or closing properly but the values are not getting

Re: File handling problem.

2009-05-02 Thread Pascal Chambon
subhakolkata1...@gmail.com a écrit : Dear Group, I am using Python2.6 and has created a file where I like to write some statistical values I am generating. The statistical values are generating in a nice way, but as I am going to write it, it is not taking it, the file is opening or closing

Re: File handling problem.

2009-05-02 Thread Steven D'Aprano
On Sat, 02 May 2009 01:26:14 -0700, subhakolkata1234 wrote: Dear Group, I am using Python2.6 and has created a file where I like to write some statistical values I am generating. The statistical values are generating in a nice way, but as I am going to write it, it is not taking it, the