Modify the changeLittle function to use readLines instead of read.

Note: The question refers to the “readlines” method.


```
def changeLittle(filename ,newString):
# Get the original file contents
programFile="littlePicture.py"
file = open(getMediaPath(programFile),"rt")
lines = file.readlines()
file.close()
# Now, find and change the line
for index in range(0, len(lines)):
if "addText" in lines[index]:
#First double quote
firstQuote = lines[index].find('"')
#Double quote after firstQuote
endQuote = lines[index].find('"',firstQuote+1)
newLine = lines[index][:firstQuote+1]+ newString +lines[index][endQuote:]
lines[index] = newLine

# Make our new file
newFile = open(getMediaPath(filename),"wt")
for line in lines:
newFile.write(line)
newFile.close()
```

Computer Science & Information Technology

You might also like to view...

The ____ print style prints a daily appointment schedule for a specific date.

A. Day B. Tri-fold C. Calendar Details D. Schedule

Computer Science & Information Technology

The database administrator uses the ____ command to revoke privileges from users.

A. DROP B. REMOVE C. REVOKE D. CANCEL

Computer Science & Information Technology

A technician is troubleshooting a computer that will not connect to the Internet. The PC is connected to the network. Which of the following tools should the technician use FIRST to understand the NIC configuration?

A. Protocol analyzer B. ipconfig C. nslookup D. tracert

Computer Science & Information Technology

Explain why image resolution is such an important consideration for a web graphic.

What will be an ideal response?

Computer Science & Information Technology