I'm getting this error, can someone show me where I went wrong.
import requests
import time
with open("C:\\temp\\cars.txt", 'r') as myfile:
data1 = myfile.read()
searchKey = "ford="
searchEndKey = '"'
auto = data1.text[data1.text.find(searchKey) + len(searchKey):
data1.text.find(searchEndKey, data1.text.find(searchKey) +
len(searchKey) + 1)]
with open("C:\\temp\\cars2.txt", "rt") as fin:
with open("C:\\temp\\cars3.txt", "wt") as fout:
for line in fin:
fout.write(line.replace('ford=', 'ford='+auto))
AttributeError: 'str' object has no attribute 'text'
strwould have atextattribute?.text