Q:

Python: AttributeError: 'str' object has no attribute 'readlines'

I am trying to copy text from mobileBuildSettings and use it to replace text from abproject. I am getting the following error and I don't understand it.
AttributeError: 'str' object has no attribute 'readlines'

Below is my code:
with open("C:/abproject.build", "r+") as script, open ("C:/tempfile.build","w+") as newscript:
abproject = ("C:/abproject.build")
for line in abproject.readlines():
    if line == "@AppIdentifier@" :
        newabproject.write('"' + "AppIdentifier : " + '"' + appIdentifier.get() + '"' + "\n")
    else:
        newabproject.write(line)
abproject.close()
newabproject.close()
os.remove("abproject.txt")
os.remove("tempfile.buil","abproject.txt")

A:

In order to give a good answer to jill1993's question and take the MosesKoledoye's answer :
abproject = ("C:/abproject.build")

abproject is a string object. Furthermore, you write :
with open("C:/abproject.build", "r+") as script

So if you want to solve your script error, you have to write :
with open("C:/abproject.build", "r+") as script, open ("C:/tempfile.build","w+") as newscript:
abproject = ("C:/abproject.build")
for line in script.readlines():
    if line == "@AppIdentifier@" :
        newscript.write('"' + "AppIdentifier : " + '"' + appIdentifier.get() + '"' + "\n")
    else:
        newscript.write(line)
script.close()
newscript.close()
os.remove("abproject.txt")
os.remove("tempfile.buil","abproject.txt")

And your script should work ;)

