Re: File Handling Problem

2009-09-06 Thread joy99
On Sep 5, 11:49 am, Chris Rebert wrote: > On Fri, Sep 4, 2009 at 11:39 PM, > SUBHABRATABANERJEE wrote: > > > > > 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 Thanx for your kind reply

Re: File Handling Problem

2009-09-04 Thread Chris Rebert
On Fri, Sep 4, 2009 at 11:39 PM, SUBHABRATA BANERJEE wrote: > 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

Re: File Handling Problem

2009-09-04 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) File

Re: File Handling Problem

2009-09-04 Thread Rami Chowdhury
No: readlines () retains the "\n"s; splitlines () loses them Ah, thank you for the clarification! On Fri, 04 Sep 2009 08:39:37 -0700, Tim Golden wrote: Rami Chowdhury wrote: f = open("myfile.txt", "r") list_one = f.read().splitlines() f.close() Or use f.readlines(), which would do the

Re: File Handling Problem

2009-09-04 Thread Tim Golden
Rami Chowdhury wrote: f = open("myfile.txt", "r") list_one = f.read().splitlines() f.close() Or use f.readlines(), which would do the same thing IIRC? No: readlines () retains the "\n"s; splitlines () loses them TJG -- http://mail.python.org/mailman/listinfo/python-list

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 wrote: joy99 wrote: Dear Group, I have a file. The file has multiple lines. I want to get the line numb

Re: File Handling Problem

2009-09-04 Thread Lucas Prado Melo
On Fri, Sep 4, 2009 at 9:50 AM, joy99 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 following line as outp

Re: File Handling Problem

2009-09-04 Thread Stephen Fairchild
joy99 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 following line as output. The > problem as I see is ni

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-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 wrote: > On Sun, May 3, 2009 at 9:51 AM, SUBHABRATA BANERJEE > wrote: > > Dear Group, > > > > > >

Re: File handling problem.

2009-05-03 Thread Chris Rebert
On Sun, May 3, 2009 at 9:51 AM, SUBHABRATA BANERJEE 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 > >     open_file=open("/python26/New

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 open_corp_eng=open("/python26/

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, t

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 prop

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 sto