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

Shurui Liu (Aaron Liu) shurui91 at gmail.com
Sun Mar 28 23:23:35 CEST 2010


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?

-- 
Shurui Liu (Aaron Liu)
Computer Science & Engineering Technology
University of Toledo


More information about the Tutor mailing list