Re: Changing the middle of strings in a list--I know there is a better way.

2008-10-21 Thread Terry Reedy
Duncan Booth wrote: Ben <[EMAIL PROTECTED]> wrote: Since strings are immutable I can't assign different values to a specific slice of the string. How can I accomplish this? You probably don't want to use readlines. It is almost always cleaner just to iterate over the file itself. You can'

Re: Changing the middle of strings in a list--I know there is a better way.

2008-10-21 Thread Ben
On Oct 21, 1:53 pm, "J. Cliff Dyer" <[EMAIL PROTECTED]> wrote: > On Tue, 2008-10-21 at 10:28 -0700, Ben wrote: > > Hello All: > > > I am new to Python, and I love it!! I am running 2.6 on Windows. I > > have a flat text file here is an example of 3 lines with numbers > > changed for security: > > >

Re: Changing the middle of strings in a list--I know there is a better way.

2008-10-21 Thread J. Cliff Dyer
On Tue, 2008-10-21 at 10:28 -0700, Ben wrote: > Hello All: > > I am new to Python, and I love it!! I am running 2.6 on Windows. I > have a flat text file here is an example of 3 lines with numbers > changed for security: > > 9088869199020081099 > 9088869199020

Re: Changing the middle of strings in a list--I know there is a better way.

2008-10-21 Thread Duncan Booth
Ben <[EMAIL PROTECTED]> wrote: > Since strings are > immutable I can't assign different values to a specific slice of the > string. How can I accomplish this? > ... > #My Current Code > > # read the data file in as a list > F = open('C:\\path\\to\file', "r") > List = F.readlines() > F.close() >

Changing the middle of strings in a list--I know there is a better way.

2008-10-21 Thread Ben
Hello All: I am new to Python, and I love it!! I am running 2.6 on Windows. I have a flat text file here is an example of 3 lines with numbers changed for security: 9088869199020081099 9088869199020081099 9088869199020081099 I want to