[Tutor] how to change some words in a text file

2010-03-28 Thread Shurui Liu (Aaron Liu)
Here's the thing, I wanna change some wrong words from a text file like this: "I am a studaet." -> "I am a student." I have tried to use this command: str = "I am a studaet." newstr = str[0:8] + "ent" print newstr But the system said TypeError: 'type' object is unsubscriptable What's wrong

Re: [Tutor] how to change some words in a text file

2010-03-28 Thread Emile van Sebille
On 3/28/2010 2:23 PM Shurui Liu (Aaron Liu) said... Here's the thing, I wanna change some wrong words from a text file like this: "I am a studaet." -> "I am a student." I have tried to use this command: str = "I am a studaet." newstr = str[0:8] + "ent" print newstr But the system said Ty

Re: [Tutor] how to change some words in a text file

2010-03-28 Thread Shashwat Anand
>>> s = "I am a studaet." >>> new_s = s[0:8] + 'ent' >>> print new_s I am a sent You are using str as a variable, str is used to convert anything into string >>> a = 0 >>> b = str(a) >>> type(b) On Mon, Mar 29, 2010 at 2:53 AM, Shurui Liu (Aaron Liu) wrote: > Here's the thing, I wanna change

Re: [Tutor] how to change some words in a text file

2010-03-28 Thread Shurui Liu (Aaron Liu)
Tell me how to do what i want, please. 2010/3/28 Shashwat Anand : s = "I am a studaet." new_s = s[0:8] + 'ent' print new_s > I am a sent > > You are using str as a variable, str is used to convert anything into string > a  = 0 b = str(a) type(b) > > > > On Mon, Mar 2

Re: [Tutor] how to change some words in a text file

2010-03-28 Thread Walter Prins
On 28 March 2010 23:37, Shurui Liu (Aaron Liu) wrote: > Tell me how to do what i want, please. > Both me and someone else have already told you how to replace a substring in a string with something else in your earlier question/posting/thread. If you've not understood what was written there, th