import os, sys
pandaFile = open("panda.txt", "w")
pandaRead = pandaFile.read()
if "NOON" in pandaRead:
print("Enter a noon:")
noon = input()
str.replace("NOON",noon)
if "ADJECTIVE" in pandaRead:
print("Enter an adjective:")
adjective = input()
str.replace("ADJECTIVE", adjective)
if "VERB" in pandaRead:
print("Enter and verb:")
verb = input()
str.replace("VERB",verb)
newcontent = open("panda.txt","w")
My goal is to open the file "Panda.txt" file. If there is ADVERB, VERB, or NOON, replace these string by the user input.And re-write the "panda.txt" file.
My error code is:
pandaRead = pandaFile.read()
io.UnsupportedOperation: not readable
I am using Sublime text 2 with Python 3.4 on a Windows Vista Home Version.